You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like guide_colorbar() doesn't support override.aes() like its other guide_*() counterparts. As an example:
library(tidyverse)
mtcars %>%
ggplot(aes(x=mpg, y=disp)) +
geom_point(aes(color=disp), alpha=0.5) +# Below line has no effect because guide_colorbar doesn't support override.aes
guides(color= guide_colorbar(override.aes=list(alpha=0.5)))
# Using guide_legend works, but converts to incorrect binned legend instead of colorbar legendmtcars %>%
ggplot(aes(x=mpg, y=disp)) +
geom_point(aes(color=disp), alpha=1) +
guides(color= guide_legend(override.aes=list(alpha=0.5)))
I would like to adjust the colorbar legend to also have alpha = 0.5 for consistency but I can't seem to find a good way to do this without using override.aes(). I think having override.aes() available in guide_colorbar would be useful in situations like this to maintain consistency across the plot.
As another example use case, I often make choropleth maps with continuous colorbar legends using geom_sf and often fiddle with the alpha transparency of some layers to make the maps more readable . It would be nice to have the colorbar legend reflect these changes. Totally understand if this is very complex, but just thought I'd ask!
The text was updated successfully, but these errors were encountered:
I think the reason that the colourbar/coloursteps guides don't have an override.aes argument is because it doesn't take any information from the layers, aside from whether there is an appropriate layer (as opposed to legend, which copies details from aesthetics). I don't really see an alpha as a mapping that can be reflected in a colourbar, but it would makes sense as a fixed property. Aside from alpha, are there any aesthetics that are eligible to be overridden in colourbars?
It seems like
guide_colorbar()
doesn't supportoverride.aes()
like its otherguide_*()
counterparts. As an example:I would like to adjust the colorbar legend to also have
alpha = 0.5
for consistency but I can't seem to find a good way to do this without usingoverride.aes()
. I think havingoverride.aes()
available inguide_colorbar
would be useful in situations like this to maintain consistency across the plot.As another example use case, I often make choropleth maps with continuous colorbar legends using
geom_sf
and often fiddle with thealpha
transparency of some layers to make the maps more readable . It would be nice to have the colorbar legend reflect these changes. Totally understand if this is very complex, but just thought I'd ask!The text was updated successfully, but these errors were encountered: