-
Notifications
You must be signed in to change notification settings - Fork 18
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
[BUG] Missed legend: Where is Wally? #29
Comments
Thanks! I'll look into it! |
I can't reproduce on the CRAN version of ggnewscale, but can on the dev version. For now, try installing ggnewcale with |
Investigating further, The issue with the disappearing guides is that ggplot2 is merging them because they have the same name and values (see: tidyverse/ggplot2#4280). There's nothing I can do from ggnewcale side of things. What you can do is to change the library(tidyverse)
library(ggsci)
library(ggnewscale)
data(mtcars)
mtcars %>%
rownames_to_column("rnames") %>%
as_tibble() %>%
mutate_all(as_factor) %>%
select(rnames, vs, am, gear, carb) %>%
gather(key = "key", value = "value", -rnames) -> temp
#> Warning: attributes are not identical across measure variables;
#> they will be dropped
ggplot() +
geom_tile(
data = temp %>% filter(key=="vs") %>% droplevels,
aes(key, rnames, fill=value)
) +
scale_fill_simpsons(name = "simpsns") +
new_scale_fill() +
geom_tile(
data = temp %>% filter(key=="am") %>% droplevels,
aes(key, rnames, fill=value)
) +
scale_fill_rickandmorty(name ="rick") +
new_scale_fill() +
geom_tile(
data = temp %>% filter(key=="gear") %>% droplevels,
aes(key, rnames, fill=value)
) +
scale_fill_futurama(name ="futurama") +
new_scale_fill() +
geom_tile(
data = temp %>% filter(key=="carb") %>% droplevels,
aes(key, rnames, fill=value)
) +
scale_fill_tron(name ="tron") +
theme(legend.position="bottom") Created on 2020-12-01 by the reprex package (v0.3.0) |
I'm closing this for now, since it's something on ggplot2 side of things. |
Thank you, this solution you give me is enough |
Hi,
Thanks for this package which makes it easy to deal with scales.
I think it might be a BUG.
I was trying to do a
geom_tile
with categorical values on the x and y-axis where each value along the x-axis has its color scale.A heatmap where each column has a color scale and legend
So, I manipulated
mtcars
just to test code, and BANG, after the last tile I missed the legend.Full example is here
Here is the code I did.
Created on 2020-11-30 by the reprex package (v0.3.0)
Thanks in advance.
The text was updated successfully, but these errors were encountered: