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.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA