Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

How to subscript/superscript and italicize x-axis labels?

$
0
0

I am trying to re-name the x-axis labels and would like to subscript/superscript few letters and numbers. For example, In FG(5,6)a I would like to italicize 'F' and would like to subscript/superscript 'a'. Likewise, I would like superscript/subscript and italicize '2' in KA(2,3)2, and a in LS(5,6)ab. Is there a way I can do this in R? Here is my code and output figure:

p <- ggbarplot(my_data_stack, x = "ind", y = "values", color = "ind", fill = "ind", 
                palette =c("blue", "green", "orange", "red", "black", "yellow"),
                width = 0.4, add = c("mean_se"))
p                
p +  scale_x_discrete(labels=c("a" = "SO", "b" = "KA(2,3)2", "c" = "FG(5,6)2", "d" = "FG(5,6)a", "e" = "LS(5,6)ab",
                                     "f" = "FG(1,5)f"))

enter image description here


Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>