[R] (senza oggetto)

(Ted Harding) ted.harding at wlandres.net
Mon Oct 11 14:51:28 CEST 2010

On 11-Oct-10 12:07:43, Barbara.Rogo at uniroma1.it wrote:
> I have the y-axe in a grafich that has as extreme limit 0.00 and 1.50.
> "plot" gives me the interval 0.0, 0.5,1.0,1.5 but I want:
> 0.00,0.15,0.30 and so on with 2 decimals. How can I do? Thanks
>       [[alternative HTML version deleted]]
> ______________________________________________

The key to this is the plot() parameter yaxp [see below].

So, for instance,

x <- (0:5)
y <- 1.5*(x^2)/(5^2) ## y-values range from 0 to 1.5
plot(x, y, ylim=c(0,1.5), yaxp=c(0,1.5,10))

## And compare with:
plot(x, y, ylim=c(0,1.5))

The explanation of 'yaxp' (and its x-friend xaxp) can be
found is '?par'. The full details are under 'xaxp':

'xaxp' A vector of the form 'c(x1, x2, n)' giving the
       coordinates of the extreme tick marks and the
       number of intervals between tick-marks when
       'par("xlog")' is false. [...]

As explained under 'yaxp', this is constructed in the
same way as 'xaxp.

So you have y ranging from 0 to 1.5 by steps of 0.15,
hence a total of 10 intervals, therefore

  yaxp = c(0,1.5,10)

It is unfortunate that the documentation for the large
number of parameters and features for graphics, even
for the basic plot() function (which will be every
beginner's starting point) is fragmented over many
different documentation entries.

If you start with '?plot', not yet knowing where you
should be looking, it could take you several tries in
different places before you find what you want!

Hoping this helps,

E-Mail: (Ted Harding) <ted.harding at wlandres.net>
Fax-to-email: +44 (0)870 094 0861
Date: 11-Oct-10                                       Time: 13:51:24
------------------------------ XFMail ------------------------------

More information about the R-help mailing list