Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to change the axis of the plot titles in a ggplot in R

Does anybody know, how do I change the plot titles (annotated by the red arrow) to be horizontal in the following ggplot? And how do I move them to the left-hand side instead of having them on the right?

My code is as follows:

  coord_cartesian(ylim=c(min(mdf["value"]), max(mdf["value"]))) +
  theme(axis.text.y=element_blank(),
        axis.ticks.y=element_blank()) +
  xlab("Time (s)") +
  ylab("Channel signals") +
  geom_line() + 
  facet_grid(variable ~ .)

Thank you!!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

To change the side, use

facet_grid(variable ~ ., switch = "y")

To rotate the labels, add the following to theme:

strip.text.y.left = element_text(angle = 0)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading