[R] bubble(circle) plot help.

Yihui Xie xieyihui at gmail.com
Thu Sep 18 07:33:57 CEST 2008


I don't quite understand your R code (I think your random numbers make
the graph very hard to read!), but I have also written an example for
the interaction effect:

## 400 bubbles to show the interaction of x and z
sq = seq(0, 10, length = 20)
x = rep(sq, 20)
z = rep(sq, each = 20)
y = c(outer(sq, sq, function(x, z) 10 + 1 * x + 0.5 *
    z + 0.5 * x * z + runif(1)))
symbols(x, z, y, bg = rgb(1, 0, 0, 0.1), fg = "yellow")
## observe the bubbles from the x-axis or y-axis

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Thu, Sep 18, 2008 at 11:18 AM, Wen Gu <edwardg22486 at hotmail.com> wrote:
> hey, you suggestion worked great last time.  I was able to create a graph
> through simulation. However, now I am having trouble manipulating the
> simulated effects of the graph.  The code I attached has simulated data
> values for all 3 values, and is plotting a graph showing an interaction with
> all 3 variables. I am trying to create extreme effects by having the circle
> size increase, with increased X value, while holding the other variable
> somewhat constant (and then do the other).  Yet, when I try to change the
> mean of these values, the scales merely adjusts to account for the increased
> means.
>
>> Date: Sat, 13 Sep 2008 11:58:28 +0800
>> From: xieyihui at gmail.com
>> To: edwardg22486 at hotmail.com
>> Subject: Re: [R] bubble(circle) plot help.
>> CC: r-help at r-project.org
>>
>> The function symbols() is in the package 'graphics', so you don't need
>> any add-on packages.
>>
>> For example:
>>
>> # similar code to the example you mentioned
>> set.seed(1)
>> symbols(x = rnorm(50), y = rnorm(50), circles = abs(rnorm(50)),
>> main = 'Circles Plot')
>>
>> Yihui
>>



More information about the R-help mailing list