You can use one of two approaches:
Limit calculation
xlim <- c(0, max(xvalues))
xlim can now be represented as an argument to xlim in plot .
xvalues <- 100:200 yvalues <- 250:350 plot(xvalues, yvalues, xlim=xlim)

Let par return the limits
This is a little more complicated, but sometimes useful (certainly redundant in your case, but for completeness). You print the data once, you get the borders of the chart area in user coordinates using par("usr") . Now you can use them in your new plot.
plot(xvalues, yvalues, xaxs="i") xmax <- par("usr")[2] plot(xvalues, yvalues, xlim=c(0,xmax))
PS. I used xaxs="i" , so the results will be without small extensions at the ends.
Mark heckmann
source share