-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
When I use scale_fill_stepsn()
, the legend does not show the minimum & maximum value on the legend. When I try to change this by providing a label vector, I get an error “Breaks and labels are different lengths”, although they have the exact same length.
This happend using R version 4.1.0 on Windows 10, using ggplot2 version 3.3.5.
(link to my question on SO)
teunbrand on SO pointed out this issue might be related to the fix of #4423.
This is the plot without changing the labels:
This is the code for with & without changing the labels, including dummy data:
df_test <- data.frame(long = rep(447030:447050, 21),
lat = rep(5379630:5379650, each=21),
z = rnorm(21*21))
ggplot(df_test) +
geom_tile(aes(x=long, y = lat, fill = z)) +
scale_fill_stepsn(
limits = c(-3, 3), breaks = seq(-3, 3, 1), labels = seq(-3, 3, 1),
colors = c("#ff6f69", "grey90", "#00aedb"))
Edit: I just needed to use show.limits = TRUE
, but I guess the issue with the label
argument remains?
teunbrand
Metadata
Metadata
Assignees
Labels
No labels