Manipulating strip text in a single facet title (among many)

33 views
Skip to first unread message

trichter

unread,
Jun 18, 2015, 7:39:56 AM6/18/15
to ggp...@googlegroups.com
Hi!

A more general question. I have a facet wrap of 25 factors. One of them is a biological species name, and i am supposed to have that in italics.

Is it possible to manipulate only ONE facet title?

Cheers!

Tim

Brian

unread,
Jun 18, 2015, 8:47:35 AM6/18/15
to trichter, ggp...@googlegroups.com
Yes!

as an expression:

change the level (factor name) from 'species' to 'italic(species)'

Best
Brian
> --
> --
> You received this message because you are subscribed to the ggplot2
> mailing list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google
> Groups "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ggplot2+u...@googlegroups.com
> <mailto:ggplot2+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Roman Luštrik

unread,
Jun 18, 2015, 9:31:08 AM6/18/15
to trichter, ggplot2
If you are able to use facet_grid, you can easily adjust levels and use a labeller to convert the "?plotmath" to human readable expression.

library(ggplot2)

levels(iris$Species)[levels(iris$Species) %in% "setosa"] <- "italic('Iris setosa')"
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
  theme_bw() +
  geom_point() +
  facet_grid(~ Species, labeller = label_parsed)


Cheers,
Roman

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.
Reply all
Reply to author
Forward
0 new messages