Entering edit mode
1 day ago
Bine
▴
80
Good afternoon,
I was wondering if anyone could guide me here: I would like to change my current plot in a way that I get the overall response rate (percentage of Responders) in the y-axis. I am not interested to show the percentage of Non-responder. Then I would also remove the current legend.
Current code:
p<-metadata %>%
dplyr::count(triplet_douplet, ORR) %>%
dplyr::group_by(triplet_douplet) %>%
dplyr::mutate(prop = n / sum(n)) %>%
ggplot(aes(x =triplet_douplet, y = prop, fill =ORR)) +
geom_col(position = position_dodge()) +
geom_text(aes(label = round(100 * prop)),
position = position_dodge(.9), vjust = -.2
)
I have been trying different attempts but no success yet. Any ideas?
If i understand correctly, why not just change the mutate bit to:
As well as removing the
100
from thegeom_text
command.You can also remove the legend by using:
Thanks for your reply. But this is not what I meant. My aim is to get something like this:
I am not interested in the percentage of the non-responder, just show the percentage of the responder:
have you tried something like this before the
ggplot
command?Great, yes like this it is working! Thanks so much.
Sharing the code in case someone is interested:
I have one final question: In case I want to replace "ORR" in fill with "height" it gives me this error, even so "height" is a variable in metadata. Maybe it happens because I filter and it cannot longer recognise it?!
Thanks again!
Hard to say without looking at the data and the ggplot command, are you sure this is column is around?
Yes this column is in metadata.