UseR10085
UseR10085

Reputation: 8200

How to make subscript in xarrow title in ggtern plot?

I am trying to make subscript in xarrow, yarrow and zarrow title of ggtern plot as given in its example using the following code

library(ggtern)
data(Feldspar)

ggtern(data=Feldspar,aes(x=Ab,y=An,z=Or)) + 
labs( x       = "NaAlSi_3O_8",
      xarrow  = "Albite, NaAlSi_3O_8",
      y       = "(Na,K)AlSi_3O_8",
      yarrow  = "Anorthite (Na,K)AlSi_3O_8",
      z       = "KAlSi_3O_8",
      zarrow  = "Orthoclase KAlSi_3O_8") + 
theme_latex(TRUE) + 
geom_point() + 
theme_showarrows() + 
theme_clockwise()

enter image description here

As it can be seen from the above plot that subscript is not working. So, I have tried to use expression which worked for x, y, z labs but not for xarrow, yarrow and zarrow

ggtern(data=Feldspar,aes(x=Ab,y=An,z=Or)) + 
  labs( x       = expression(NaAlSi[3]~O[8]),
        xarrow  = expression(paste("Albite,"~NaAlSi[3]~O[8])),
        y       = expression(paste("(Na,K)"~AlSi[3]~O[8])),
        yarrow  = expression(paste("Anorthite (Na,K)"~AlSi[3]~O[8])),
        z       = expression(KAlSi[3]~O[8]),
        zarrow  = expression(paste("Orthoclase,"~KAlSi[3]~O[8]))) + 
  theme_latex(TRUE) + 
  geom_point() + 
  theme_showarrows() + 
  theme_clockwise()

enter image description here

How can I make subscript in xarrow, yarrow and zarrow?

Upvotes: 0

Views: 51

Answers (0)

Related Questions