Ggplot2: Difference between revisions

 
Line 43: Line 43:
apt-get install ghostscript -y
apt-get install ghostscript -y
</pre>
</pre>
===Legends===
[https://ggplot2.tidyverse.org/articles/articles/faq-customising.html?q=legend#legends Customizing FAQ]<br>
[https://ggplot2.tidyverse.org/reference/guide_legend.html guide_legend]
<syntaxhighlight lang="R">
# Move legend to the bottom
plot <- plot +  theme(legend.position = "bottom")
# Set color legend to have two rows
plot <- plot +  guides(color=guide_legend(nrow=2, byrow=TRUE))
</syntaxhighlight>