Adding both superscripts and subscripts to plot
A combination of subscripts or superscripts can be appended to the plot strings using the ^ or [] operators. The * sign is appended each time the character string breaks into a part.
Example:
Here we are plot an expression log”[a]*”10″^2 for the integers 1 to 6. The string “log” is combined with the subscript [a] and then combined with the string “10” along with the superscript 2 formatted with ^ symbol.
R
# creating numbers numb < - 1: 6 # creating the x axis labels # creating a plot plot (numb, xlab= expression ( "log" [a]* "10" ^ 2)) |
Output:
How to Add Superscripts and Subscripts to Plots in R?
Plots can be used to create and display numerical values or data points. The x and y axes labels or titles are used to depict the labels to the plot data. These labels can create either subscript or superscript symbols within them. This can be done using various base R methods :
Contact Us