logo

Adding Subscripts to Axis Labels in R Graphs 📂R

Adding Subscripts to Axis Labels in R Graphs

Code

ddssf.png In R, it is allowed to include underscores _ in variable names, but if they are displayed like that on a graph, readability can be severely reduced. Using the expression() function as follows allows for nicely adding subscripts to axis names.

data<-as.numeric(lynx)
win.graph(4,4)
plot(data[-1],data[-length(data)],type='p \',main='아래첨자 사용',
     xlab=expression(Y[t]),ylab=expression(Y[t-1]))