I want to increase the vertical space between the labels (setoda, versicolor and virginica) and their respective panels. How can I do this? The regular options like panelspacing and margins
don't seem to have an effect.
library(ggplot2)
library(grid)
ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_point() +
facet_wrap( ~ Species) +
theme(strip.text.x = element_text(face = "italic")) +
theme(strip.background = element_blank())
One option would be to increase the margin
around the strip.text
:
library(ggplot2)
p <- ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_point() +
facet_wrap(~Species) +
theme(strip.background = element_blank())
p +
theme(strip.text.x = element_text(
face = "italic",
margin = unit(rep(50, 4), "pt")
))
Or using margin()
and increasing only the bottom margin:
p +
theme(strip.text.x = element_text(
face = "italic",
margin = margin(4.4, 4.4, 50, 4.4, "pt")
))