-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Axis label formatting fails when position is changed #5
Comments
This comment has been minimized.
This comment has been minimized.
This actually works. You have to style the correct theme element. library(ggplot2)
library(ggtext)
labels <- c(
setosa = "This is<br>*I. setosa*",
virginica = "This is<br>*I. virginica*",
versicolor = "This is<br>*I. versicolor*"
)
ggplot(iris, aes(Species, Sepal.Width)) +
geom_boxplot() +
scale_x_discrete(
position = "top",
name = NULL,
labels = labels
) +
theme(
axis.text.x.top = element_markdown(color = "black", size = 11)
) Created on 2019-10-07 by the reprex package (v0.3.0) |
I see, thanks for pointing that out! Looking at the |
No, it behaves as expected. library(ggplot2)
library(ggtext)
labels <- c(
setosa = "This is<br>*I. setosa*",
virginica = "This is<br>*I. virginica*",
versicolor = "This is<br>*I. versicolor*"
)
# example 1, parameters are inherited but no markdown
ggplot(iris, aes(Species, Sepal.Width)) +
geom_boxplot() +
scale_x_discrete(
position = "top",
name = NULL,
labels = labels
) +
theme(
axis.text.x = element_markdown(color = "red", size = 15)
) # example 2, now with markdown
ggplot(iris, aes(Species, Sepal.Width)) +
geom_boxplot() +
scale_x_discrete(
position = "top",
name = NULL,
labels = labels
) +
theme(
axis.text.x = element_text(color = "red", size = 15),
axis.text.x.top = element_markdown()
) Created on 2019-10-07 by the reprex package (v0.3.0) |
I see, thanks for taking the time to explain. |
Thanks for the great package!
I would like to format labels and move the label position using the
position
argument ofscale_x
etc, but it doesn't seem to work.Created on 2019-09-29 by the reprex package (v0.3.0)
Session info
The text was updated successfully, but these errors were encountered: