[R] multiple data sets on one plot

Marc Schwartz (via MN) mschwartz at mn.rr.com
Wed Jun 7 17:49:52 CEST 2006


On Wed, 2006-06-07 at 10:30 -0500, Mark L Sessing wrote:
> Hello,
> 
> I am learning how to use R, and I cannot figure out how to plot more 
> than one data set on a single plot.  Can you help me out?
> 
> Cheers,
> Mark

It depends upon the type of plot (scatter, lines, bar, etc.) and whether
or not you are using R's base graphics or lattice graphics.

With more information, we can offer specific guidance.

For example, with base graphics, you can add additional plot components
with:

?lines
?points
?segments
?matpoints (Note also matplot() on the same page)
?curve
?arrows

A good starting place would be Chapter 12 "Graphical Procedures" in An
Introduction to R, which is available within your R installation (on
Windows from the GUI menus) or from the Documentation links on the R
home page.

An additional resource is the R Graph Gallery:

  http://addictedtor.free.fr/graphiques/index.php

and Chapter 3 "From Data to Graphics" by Vincent Zoonekynd here:

  http://zoonek2.free.fr/UNIX/48_R/all.html

HTH,

Marc Schwartz



More information about the R-help mailing list