[R] plot-parameter pch without influence when plotting a data-frame

John Kane jrkrideau at yahoo.ca
Fri Oct 10 15:45:18 CEST 2008




--- On Fri, 10/10/08, Oliver Bandel <oliver at first.in-berlin.de> wrote:

> From: Oliver Bandel <oliver at first.in-berlin.de>
> Subject: Re: [R] plot-parameter pch without influence when plotting a data-frame
> To: jrkrideau at yahoo.ca

 

> > >
> > > > what is the result of:
> [...]
> 
> 
> > Try something like
> > mm <- matrix(1:128, nrow= 4)
> > matplot(mm, pch=1:128)
> 
> OK, it plots some symbols, but also after plotting
> there was printed a message that 24 warnings occured.

Forgot to mention that some values do not have a character defined.  Ignore the warings :)
> 
> 
> >
> > to get some idea of what symbols are available.
> >
> > >
> > > Do you know how to plot very small dots?
> > >  pch=20 makes dots that are too big for my plot.
> >
> > matplot(mm, pch=20, cex=.5)
> 
> 
> Oh, interesting and this seems to be the solution to get
> small-enough
> points!
> 
> 
> I'm just playing around with cex (as plot-param and set
> by par())
> and it is the thing I looked for. Now I can use those
> filled circles
> and scale them down in size. :)

Good question.  I am at a machine that does not have R today.

See if this example will do what you want.

===========================================================

car  <- c(rep("Mazda",3), rep("Renault", 5), rep("Trabant", 2)) 
speed  <- c( 45,64,28,56,76,43,56,69, 10,20)    
seat  <-  c(2,3,4,3,2,4,3,4,2,1)  # Number of seats in each type of car

plot (speed, seat, pch="", xlim=c(0,100), ylim=c(0,5))

symbols(speed, seat, circles=seat*2, inches=FALSE, add=TRUE)

text(speed,seat, labels=car, cex=.4, col='red')



      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at
http://ca.toolbar.yahoo.com.



More information about the R-help mailing list