Closed GreenGilad closed 1 year ago
Currently there's a bug when using more than 2 scales (see #45 for a workaround). It's not an obvious fix and I haven't had the time to look deeper into it.
A possible fix is to change the function to: new_scale("alpha", "some.name") instead of only adding the _new (or leaving it as the default behavior) and then using that name in the guides will probably work
This is a fantastic idea. I'll implement it for the next release.
Thanks for the quick reply!
I tried the workaround of returning to a previous version but it didn't seem to work (I think the issue is a bit different). Will wait for the next release :)
Huh, then it might be a different issue. I'll look into it.
This should be fixes on the latest dev, which is now on its way to CRAN.
Hi,
I am trying to use
ggnewscale
to plot multiple sets of points each with their own color and alpha scales. I run the following codeand get the plot: where as visible the point size and color are in different guides in the legend. By adding
guides(color_new=guide_legend(g), alpha_new=guide_legend(g))
after thenew_scale("color")
in the loop I am able to get a warning:and the following plot:
This is almost there but there is a problem: now the legned isn't aligning with the correct set of points. Looking a bit into the code it is probably because the new scales are named
X_new
and then next timeX_new_new
andX_new_new_new
. Then the line of theguides
won't work as hoped.A possible fix is to change the function to:
new_scale("alpha", "some.name")
instead of only adding the_new
(or leaving it as the default behavior) and then using that name in theguides
will probably work