-
-
Notifications
You must be signed in to change notification settings - Fork 95
Map or set segment_colour and segment_alpha #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
By default, map them to colour and alpha of the text, as it is done in geom_boxplot. Allow to override them. Allow both spelling of colour but default to the UK one, like the rest of ggplot2 does.
Map this to the transparency of the text
@jiho Thank you very much for your pull request! I appreciate it. Can I ask you to please confirm that this is your desired behavior for this pull request? I wonder if you intended to change the border of the label with the ggplot(
mtcars,
aes(x = wt, y = mpg, label = rownames(mtcars), colour = factor(cyl))
) +
geom_point() +
geom_label_repel(alpha = 0.33) Before this pull request:It seems that only the background color of the label is affected by the After this pull request:It seems that the segment color matches the text color. Also, the |
Hum, seems OK for Let me check against |
In |
Great, thanks. That looks good indeed! The inability to change separately the colour of the text and of the outline is a bit bothersome but again, this is the same for Thanks for being so reactive (and for |
I seem to remember that at some point during development of ggplot 2.0.0 alpha was changed to affect everything but then a decision was made to go back to the original behaviour. The main problem seems to be bar plots and "point" shapes like 21, 22, and 23, for which one usually wants to retain solid borders while making the fill transparent. |
Thanks for the precision. While it may make sense for |
@aphalo Thank you for those links! I think I'm comfortable letting @jiho Just a small note: your pull request changed the appearance of one of my vignette figures. This is OK with me, because I can change the segment color with Before pull requestAfter pull requestAter pull request,
|
@slowkow Yes, I agree with you about label. @jiho I was mostly thinking about a PR for ggplot2. It will need good argumentation to have a chance of being accepted. @jiho @slowkow If rejected for ggplot2, could a label_fixed that behaves with respect to alpha exactly as label_repel be added to ggrepel? |
Instead of adding a new function ggplot(...) + geom_label_fixed() I would recommend ggplot(...) + geom_label_repel(..., max.iter = 0) |
Yes, of course! Thanks! |
All this makes me think that really there should be separate aesthetics, than can be set or mapped separately, for each plot element: |
Also, to simplify things, both in code and visually, I would have defaulted to coloured labels with no stroke with |
@jiho Yes, very true. Visually a lot cleaner! I think if one wants to keep compatibility, one could have a geom behaving like you suggest under a different name. Most of the code could be shared, I think. (But today it seems only new geoms come to my mind.) |
@jiho Or would removing the border line/stroke of the labels be better handled as a theme setting? |
This was made possible before by pull-request #29 but was then overridden by other commits. These changes are inspired by geom_boxplot and take the best of both worlds: map to colour and alpha of text by default but allow to override with a fixed value.