Hi.
This is a ggplot that I generated.
I am looking to change the title name for each ggplot to greek letter symbols. I have typed the greek letters I want to replace each title with:
"GlobalConsumption": \Delta c^{G}_{t}
"cdiff": \Delta c^{US}_{t} - \Delta c^{ROW}_{t}
"Dollar": Dollar_{t}
"USWealthShare": \omega^{US}_{t}
"USWealthShareChange": \Delta \omega^{US}_{t}
Any ideas how I might achieve this? These are GGplots generated from the code:
"
#Top Panel
g1a=ggplot(plotdf,aes(x=index,y=value)) +
geom_line() +facet_wrap(~Impulse, scales="free") +
geom_ribbon(aes(ymin=Lower,ymax=Upper), fill = "blue", alpha = 0.3, color = NA) +
geom_point() +
geom_line() +
theme_bw()
#Bottom Panel
g1= ggplot(WS,aes(x=index,y=value)) +
geom_line() +facet_wrap(~Impulse, scales="free") +
geom_ribbon(aes(ymin=Lower,ymax=Upper), fill = "blue", alpha = 0.3, color = NA) +
geom_point() +
geom_line() +
theme_bw()
#Combining
figurea <- ggarrange(g1a,g1,
ncol = 1, nrow = 2)
"
FJCC
November 18, 2021, 4:05am
2
Here are some examples of Greek letters, subscripts, and superscripts in ggplot facet titles.
library(ggplot2)
DF <- data.frame(X=rep(1:4,4),Y=rnorm(16),
Facet=rep(c("alpha[c]^k","beta","Gamma","Delta[C[i]^k]"),each=4))
ggplot(DF,aes(x=X,y=Y))+geom_point()+
facet_wrap(~Facet,labeller = label_parsed)
Created on 2021-11-17 by the reprex package (v2.0.1)
1 Like
startz
November 18, 2021, 4:18am
3
@FJCC , you make this look very easy. Could you give a bit of explanation about how to think of getting the Greek letters in for those of us with no idea where the magic comes in?
FJCC
November 18, 2021, 4:35am
4
I found the use of labeller = label_parsed
in this post.
r, ggplot2, subscript
I should have noted that in my post. The syntax for Greek letters and superscripts was mostly due to guessing.
startz
November 18, 2021, 4:54am
5
Thank you @FJCC . Very helpful.
system
Closed
December 9, 2021, 4:55am
6
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.