Search code examples
rplotmath

how to show $\{ X_t \}$ in the title of a plot of R


How to show $\{ X_t \}$ of Latex in the title of a plot of R?

For example

 plot(slot(x,"GRID"),slot(x,"PATH"),type="l", xlab="Time t",ylab="X",
 main=paste("Simulation of \{X_t\}"))

Thanks!


Solution

  • Assuming you will provide meaningful arguments for the slot expressions, then I think there is a reasonable chance that this is what you want:

    plot(1:10,1:10,type="l", xlab="Time t",ylab="X",
          main=expression("Simulation of {"*X[t]*"}"))
    

    This is a plotmath expression that presents "t" as a subscript of "X" and that expression is enclosed in curley braces. If I have misread your request, then note that the "*" character is a separator in the plotmath syntax and the braces are simply characters than can be deleted. (The LaTeX expressions don't make a lot of sense to those of us who just use the plotmath syntax, so describing what you want in prose or mathematical jargon would work better for any clarifications.)