How to display square root sign in base R plot?

R ProgrammingServer Side ProgrammingProgramming

To display square root sign in base R plot, we can follow the below steps −

  • First of all, create a plot having square root values to display default visualisation.

  • Then, create the plot with expression function to display square root sign in the plot.

Example

Create plot in base R

Using plot function to create a plot in base R with square root values as shown below −

x<-1:10
y<-sqrt(x)
plot(x,y)

Output

Display square root sign in the plot

Create the plot with plot and expression function to display square root sign in the plot as shown below −

x<-1:10
y<-sqrt(x)
plot(x,y,ylab=expression(sqrt(x)))

Output

raja
Updated on 15-Nov-2021 10:41:29

Advertisements