-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Added three new aesthetics #233
base: master
Are you sure you want to change the base?
Conversation
- label.col.alpha - label.fill.alpha these can be used to decouple transparency values of label background and frame from the overall transparency of the shape, thus enabling the text to be rendered without alpha while having the possiblity to make the background transparent. if any of the two (or both) are defined (not NULL), their values will override the general alpha parameter, and if not, alpha will be used to make everything transparent. - segment.linewidth segment.size is somewhat misleading as it implies the length of the segment, so segment.linewidth can be used instead (it will not be converted to points like segment.size, though)
lwd = x$label.size * .pt | ||
), | ||
segment.gp = gpar( | ||
col = scales::alpha(row$segment.colour %||% row$colour, row$segment.alpha %||% row$alpha), | ||
lwd = row$segment.size * .pt, | ||
lwd = (row$segment.size * .pt) %||% row$segment.linewidth, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the default value for segment.size
is 0.5, the value for segment.linewidth
will not be used.
I'm willing to have another look at this suggestion, if you can help me to understand the intent of this change and how it should work for users. Backward compatibility is important to me, so I want to try to avoid breaking old code if possible.
Hi @ripkrizbi Thanks for the pull request, and I apologize for the long delay before my reply. I tried to modify your changes, and you can see my changes here 5820eb2 and here fa66e1f Also, I want to ask if you might be able to clarify your intent for (I want to make changes on top of your changes while giving you credit for the changes, but I also want to preserve the latest changes to ggrepel ... so I'm not sure what is the best path forward regarding commits, branches, merges, etc.) Here are two examples I added to library(ggrepel)
set.seed(42)
dat <- subset(mtcars, wt > 2.75 & wt < 3.45)
dat$car <- rownames(dat)
p <- ggplot(dat, aes(wt, mpg, label = car)) +
geom_point(color = "red") # transparent label border
p + geom_label_repel(label.color.alpha = 0) # transparent label fill
p + geom_label_repel(label.fill.alpha = 0) |
@slowkow @ripkrizbi |
@slowkow @ripkrizbi |
Great to hear from you, Pedro! It's always a joy to learn from you. Your ideas about aesthetics are very interesting. I have similar reservations about adding more and more parameters, and then trying to figure out how to keep them all organized. I very much like your idea of using Now I'm thinking that maybe I might plan to modify ggrepel in a future version to copy your ideas about Regarding guides, I have an inkling that you might appreciate ggnewscale, but I have not tried it yet and I don't know if it satisfies your needs. I might need to have a look at it next time I am struggling with guides. These examples in your ggpp documentation are very helpful: https://docs.r4photobiology.info/ggpp/reference/geom_text_s.html |
label.col.alpha
label.fill.alpha
these can be used to decouple transparency values of label background and frame from the overall transparency of the shape, thus enabling the text to be rendered without alpha while having the possibility to make the background transparent.
if any of the two (or both) are defined (not NULL), their values will override the general
alpha
aesthetic, and if not, both values will revert toalpha
segment.linewidth
segment.size
might be somewhat misleading as it implies the length of the segment, sosegment.linewidth
can be used instead (it will not be converted to points likesegment.size
, though)