Search code examples
rplotaxis-labels

how to add xlabel and ylabel to basic plot after call in r?


The code below produces a plot with the axis labels "x" and "y" overprinted by "___i" and "___j".

Is there any way to tell plot not to include the axis labels?

Passing in nulls for the axis labels to plot does not work.

Edit: The calls are separate (i.e. the call to plot is in a function, while the call to title is after the function call tp plot). So I want to include the axis labels in call to title (where they are known).

R version 3.5.0 (2018-04-23) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 8.1 x64 (build 9600)

x<-runif(100,0,1)
print(x)
y<-x^2
plot(x,y)
title("Main Title",sub="sub title",xlab="___i",ylab="___j")

Solution

  • You can use

    plot(x, y, xlab = "", ylab = "")