[R] plotting with varying dot sizes

servet ahmet çizmeli sa.cizmeli at usherbrooke.ca
Thu Dec 10 14:18:24 CET 2009


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"]))




More information about the R-help mailing list