Using the guide_legend
argument, even without specifiying any further arguments, changes my legend from a continuous legend to a discrete one.
I need to correct this (e.g. to use this: Add a box for the NA values to the ggplot legend for a continous map and then order the legends.)
df <- expand.grid(X1 = 1:10, X2 = 1:10)
df$value <- df$X1 * df$X2
ggplot(df, aes(X1, X2)) +
geom_tile(aes(fill = value))
ggplot(df, aes(X1, X2)) +
geom_tile(aes(fill = value))+
scale_fill_continuous(guide = guide_legend())
The same happens, if I specify the argument when adding it as a + guides(fill = guide_legend())
Any ideas how to make sure the legend stays unchanged, so that I can use e.g. the order
argument.
Thanks!
guide_colourbar()
instead ofguide_legend()
guide_legend()
is used for discrete scales, whereasguide_colorbar()
is the version to use for continuous scales. They should both all accept the same/similar list of arguments, such asorder=
....guide_legend
sounds like it would be a general command. Oh well :)