csdaw / ggprism

ggplot2 extension inspired by GraphPad Prism

Home Page:https://csdaw.github.io/ggprism/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to display legend title

Hongxy09 opened this issue · comments

I tried to add the legend title to my data, but I found that if I added theme_prism(base_size = 14) my legend title would disappear, if I commented this out the legend title would appear again, I don't know what is wrong, can someone help me?
I used R4.1.3 and downloaded prism version 1.0.2

theme_prism() hides the legend title by default but you can simply add it back. Hope this helps.

library(ggplot2)
library(ggprism)

data("ToothGrowth")

ggplot(ToothGrowth, aes(x = supp, y = len, fill = supp)) + 
  geom_boxplot() +
  theme_prism()

ggplot(ToothGrowth, aes(x = supp, y = len, fill = supp)) + 
  geom_boxplot() +
  theme_prism() + 
  theme(legend.title = element_text())

Created on 2022-11-17 with reprex v2.0.2