[R] plotting with varying dot sizes

Greg Snow Greg.Snow at imail.org
Thu Dec 10 18:47:31 CET 2009


The symbols function may work better than plot for this situation.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of servet ahmet çizmeli
> Sent: Thursday, December 10, 2009 6:18 AM
> To: r-help at r-project.org
> Subject: [R] plotting with varying dot sizes
> 
> Dear all,
> 
> I am trying to plot on a spatial map the punctual measurements of the
> data
> located in the file (https://opengeo.metu.edu.tr/test.csv). I'd like to
> have
> the dots in some way proportional to the magnitudes of the
> measurements.
> 
> I have difficulties with the code given below:  The dot sizes do not
> vary not
> proportionally when varying the coefficient ("0.725"). It either plots
> the dots
> extremely big or extremely small. Successively running the plot command
> from
> the command line gives each time different results in an unpredictably
> random
> way.
> 
> Is this a bug or am I missing something?
> Servet
> 
> Running R version 2.8.1 (2008-12-22) on Ubuntu 9.10.
> 
> 
> ***********************************************************************
> *******
> library(sp)
> 
> Insitu = read.table("test.csv", skip=3,sep=",")
> Header = read.table("test.csv", skip=1,sep=",",nrows=1)
> names(Insitu)= as.character(as.matrix(Header))
> CRS_4326 = CRS("+init=epsg:4326")
> 
> Insitu_sp <-
> SpatialPointsDataFrame(cbind(Insitu[,"Boylam"],Insitu[,"Enlem"]),
> data=Insitu, proj4string=CRS_4326)
> 
> plot(Insitu_sp[,"SPM"],col="black",pch=19,cex=0.725*sqrt(Insitu["SPM"])
> )
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list