Skip to content

How to define abscissa and ordinate range in R

That’s pretty trivial but I was quite happy to find it within my drafts, as it’s actually a pain to find within the R documentation. When drawing several times over a plot (to insert data from several sources), it’s often not possible to have a data source cover all the value range from all combined other data sources. So to obtain a large enough plot area, you need to manually set it’s size… This is realized simply using the xlim and ylim parameters:


Note, however, that the “x” parameter is mandatory (but can be an empty vector), so a working command would be:


Here is a sample usage where I first set up the plot area with no data, then draw some lines of different colors:


Re: [R] How to change min and max of plot axis

Posted in R (R-project).

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA