Subscribe to DSC Newsletter

I'm wondering how to produce smooth circles in R? My first try produced very irregular circles, and I decided to use squares instead of circles to represent the data points. See attached graph.

Tags: R, open source, statistical graphics

Views: 2235

Attachments:

Reply to This

Replies to This Discussion

Vincent,

Your plot is quite pretty already.

The option pch allows a variety of shapes.

try this:

x<-c(1,2,3,4,5)
y<-c(3,2,5,6,8)
sizes<-c(5,4,3,2,1)
plot(x,y,pch=21,cex=sizes)


You could also fool around with col
to make each circle a different color.
col<-c(1,2,3,4,5)
plot(x,y,pch=21,cex=sizes,col=colors)

also consider using lwd to control thickness of the symbol.
plot(x,y,pch=21,cex=sizes,col=colors,lwd=5)


Something fun is to run a 'for loop' so that the col, and pch parameters run through 1-24(?) and see what you get.

x<-c(0,25)
y<-c(0,25)
plot(x,y)
for(i in 1:24)
{
points(i,i,pch=i,col=i,lwd=3)
}


The go to for help with R plots is to look up "par" which controls the graphing parameters.


Peace dude and thank-you setting up the website.
Joe
GGobi is great but it's not very stable (2.1.7 from source on xubuntu 7.10). I regularly crash it when importing datasets or when changing colour schemes (the default brush style is out of range for schemes less than about 7 colours).
Not yet. I thought I've read somewhere that there is an option in R to make smoother dots and circles, but I don't remember the details.
did you look at the grid.circle function?

RSS

On Data Science Central

© 2019   AnalyticBridge.com is a subsidiary and dedicated channel of Data Science Central LLC   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service