Re: [R] bubble.plot() - standardize size of unit circle

From: Dan Bebber <danbebber_at_yahoo.co.uk>
Date: Sat 23 Jul 2005 - 00:20:13 EST


Thanks Martin- I didn't know about the sunflowerplot function. Somehow I prefer the look of bubbles, but I guess you're right about the visual perception. Will have to read up on it.

Dan

> Hi,
>
> >>>>> "Dan" == Dan Bebber <danbebber@yahoo.co.uk>
> >>>>> on Thu, 21 Jul 2005 12:05:45 +0100 (BST)
> writes:
>
> Dan> Hello,
> Dan> I wrote a wrapper for symbols() that
> produces a
> Dan> bivariate bubble plot, for use when
> plot(x,y) hides
> Dan> multiple occurrences of the same x,y
> combination (e.g.
> Dan> if x,y are integers).
> Dan> Circle area ~ counts per bin, and circle
> size is
> Dan> controlled by 'scale'.
>
> I'm not answering your question, but still, I need
> to ask/tell
> this:
>
> Why don't use sunflowerplot() instead?
>
> The excellent researchers who invented sunflower
> plots in the
> late 70s early 1980s knew well about "bubble"
> alternatives and
> much about drawbacks of such bubbles
> {mainly the perception laws of areas vs lengths ..}
>
> That's why they came up with the sunflowers as
> improvement ..
> See 'References' in help(sunflowerplot)
>
> Regards,
> Martin Maechler, ETH Zurich
>
>
>
>
> Dan> Question: how can I automatically make the
> smallest
> Dan> circle the same size as a standard plot
> character,
> Dan> rather than having to approximate it using
> 'scale'?
>
> Dan> #Function:
> Dan>
>
bubble.plot<-function(x,y,scale=0.1,xlab=substitute(x),ylab=substitute(y),...){
> Dan> z<-table(x,y)
> Dan> xx<-rep(as.numeric(rownames(z)),ncol(z))
> Dan>
> yy<-sort(rep(as.numeric(colnames(z)),nrow(z)))
> Dan> id<-which(z!=0)
> Dan>
>
symbols(xx[id],yy[id],inches=F,circles=sqrt(z[id])*scale,xlab=xlab,ylab=ylab,...)}
>
> Dan> #Example:
> Dan> x<-rpois(100,3)
> Dan> y<-x+rpois(100,2)
> Dan> bubble.plot(x,y)
>
>
>
> Dan>
>



>

> Store your holiday
>
> Dan>
> ______________________________________________
> Dan> R-help@stat.math.ethz.ch mailing list
> Dan>
> https://stat.ethz.ch/mailman/listinfo/r-help
> Dan> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
> Dan> !DSPAM:42df82ae77251002021314!
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 23 00:25:08 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:55 EST