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
This solved my problem! Thank you very much!
| |
***@***.***
|
|
***@***.***
|
…---- Replied Message ----
| From | Charlotte ***@***.***> |
| Date | 11/17/2022 18:33 |
| To | ***@***.***> |
| Cc | ***@***.******@***.***> |
| Subject | Re: [csdaw/ggprism] Unable to display legend title (Issue #23) |
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
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>