Replies: 1 comment 1 reply
-
Hmmm, this is an interesting idea for However it can be done with some extensions, from library(ggplot2)
library(ggside)
#> Registered S3 method overwritten by 'ggside':
#> method from
#> +.gg ggplot2
tibble::tibble(
x = 1:5,
y = 1:5,
var1 = c("A","A","A","B","B"),
var2 = c("C","D","C","D","E")
) |>
ggplot(aes(x, y)) +
geom_point() +
geom_ysidetile(aes(x = "var1", fill = var1)) +
ggnewscale::new_scale("fill") +
geom_ysidetile(aes(x = "var2", fill = var2)) Created on 2024-08-29 with reprex v2.1.1 As a note, due to how hacky my implementation of I am unsure if I will implement a way to split legends for these aesthetics |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm hoping to use ggside to make annotations on the side of my graph similar to what you would see in a heatmap annotation. I am able to make the graph and then I use geom_ysidetile to graph categorical data (like below). It plots it out nicely but then it shares a common legend since it's all falling under "yfill". I tried ggnewscale but it didn't work.
Is there a way to plot a different legend for each geom_ysidetile argument made? Any help on this issue would be appreciated!
ggside::geom_ysidetile(aes(x="Diagnosis", y=patient_id, yfill=var1)) + ggside::geom_ysidetile(aes(x="Sex", y=patient_id, yfill=var2)) + ggside::geom_ysidetile(aes(x="Location", y=patient_id, yfill=var3))
Beta Was this translation helpful? Give feedback.
All reactions