[R] Tutorial for graphics

Timur Elzhov Timur.Elzhov at jinr.ru
Thu Jun 17 10:32:29 CEST 2004


On Wed, Jun 16, 2004 at 10:12:49PM -0400, Phil wrote:

> I'm coming to R from Matlab and I'm finding it difficult to find a good
> introduction to graphics in R.  (The best I've found so far is Ch. 4 of
> Emmanuel Paradis "R for Beginners".  Still, I have been unable to discover
> simple things like how to resize the axes on an existing plot

I'm afraid it's not possible to resize existing axis, by mouse. But if
you want to add the another plot with differnet scale, you could do it
this way:
  plot(...)        # you normally plot 1st graph
  par(new = TRUE)  # 2nd graph won't clean the frame
  plot(..., axes = FALSE, xlab = "", ylab = "")  # plotting 2ng graph
  axis(4)



> how to add (or change) axis labels on an existing plot, etc.

You can plot without axes plot(..., axes = FALSE), then add axes, with
labels or not, ticks with any length, and so on.

> Can anyone point me to a suitable tutorial, or even tell me how to
> perform those tasks?

  help(plot.default)
  help(par)

> Also, Matlab's graphical widget has the ability to zoom (and unzoom) by
> drawing a rectangle on the graph with the mouse.  Is there anything similar
> in R?

Probably there are R packages perfoming such a thing, but I do not use
R interactively at all. I change xlim() and/or ylim() in R script, and
source() it again :)


--
WBR,
Timur




More information about the R-help mailing list