Skip to content
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

ggtext with element_markdown(angle = x) turns into crooked text #117

Open
CosmicOutlaw opened this issue May 25, 2024 · 1 comment
Open

Comments

@CosmicOutlaw
Copy link

CosmicOutlaw commented May 25, 2024

Following code with ggtext library loaded

theme_minimal() +
  theme(
    axis.text.x = element_text(face = "bold"),
    axis.title.x = element_text(face = "bold"),
    axis.text.y = element_text(face = "bold"),
    axis.title.y = element_text(face = "bold"),
    legend.title = element_text(face = "bold"),
    axis.text.x.top = element_markdown(angle = 45),
    axis.title.x.top = element_blank(),
    plot.title = element_text(margin = margin(b = 10)),
    plot.subtitle = element_text(margin = margin(b = 20)),
    panel.grid.major = element_line(size = 1),
    panel.grid.minor = element_line(size = 1)
    ) +
  labs(
    title = "Varieties of Democracy across U.S. Presidents",

turns into this crooked text.
Screenshot 2024-05-25 184657

Leaving angle at 0 or removing it entirely renders the text flawlessly.

ggtext can't render element_markdown with angle argument set to higher than 0.

@bwiernik
Copy link
Collaborator

In general, I would recommend using guides(x = guide_axis(angle = 30)) to set angled axis labels, rather theme(). Setting them with theme is an outdated and unpredictable approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants