ggplot make boxplots more wide
Good afternoon,
Could anyone advice me on how to to make the boxplot more wide so that you can actually see the colour of the legend?
Current plot:
Current code:
ggplot(data = metadata, aes(x=location, y=gene)) + geom_boxplot(aes(fill=Day),show.legend = TRUE)
Thank you very much!
• 1,603 views
•
link
0 answers
No answers yet.
Log in to answer this question.
If there is no interquartile range in the data then you cannot magically create it. Consider maybe
stat_summary(aes(color=Day), geom="line", fun = mean)to plot a line for the mean.geom="point"to make it a dot.If you have 1 value for each location/day, you will get a line. Prefer just plotting a dot.
What is in
metadata?Yes its actually just one sample per location / day. Location is e.g. lung and liver and day is day 1,2,3 and gene is gene expression for this location/day.
How can I change it to a dot instead of a line?
https://ggplot2.tidyverse.org/reference/geom_dotplot.html
Set colour to Day as well:
To get more specific answer, please provide example data:
dput(head(mydata, 10))Thank you everyone.