[R] Visualize quartiles of plot line

Arne Brutschy abr-r-project at xylon.de
Sun Jun 17 09:22:57 CEST 2007


Hi,

h> How about quantile regression? Have a look at
h> http://had.co.nz/ggplot2/stat_quantile.html for some examples of
h> what that might look like.
I tried the ggplot2 package, it seems to be quite powerful. But
documentation is only partially available, so I'm having some problems
creating the graphs at all.

First of all, where can I find the diamonds and dsmall data? I cannot
recreate the samples given in the documentation.

I'm currently using a simple smoother to display the tendency of the
data and it's stderr. For some reason, it works only for simple
colors:

p <- ggplot(data, aes(x=Problemsize, y=Fitness)) +
  geom_smooth(fill=alpha("blue", 0.2), colour="darkblue", size=2)

This does only display a line, not the surrounding stderr. When I
change the fill atrribute to "blue" or "grey80" without the alpha, the
stderr gets displayed.

Additionally, I want to display three different models by this, each
with a differen curve/stderr fill color. How do I do that? I tried so
set color=Model, which yields only a single line.

On another plot, I want to use a single model to be displayed with
points colored by a gradient depending on a third property:

p <- ggplot(data, aes(x=Problemsize, y=Fitness), color=DeltaConfig) +
  geom_smooth(size=1, color="black", fill="grey80")+
  geom_point(size=0.5)+
  scale_colour_gradient(limits=c(0,10), low="red", high="white")

This does not work, I think the connection between goem_point and
DeltaConfig is not there. But when I try to set

  geom_point(size=0.5, color=DeltaConfig)+

it complains about an unknown DeltaConfig object.

Hmm, I guess I don't fully understand this 'grammar of graphics'
thing. But documentation is quite inconsistent. :( And, the coloring
thing seems to be a bug. BTW, I'm using R 2.5.0 on windows.

Greetings,
Arne



h> On 6/16/07, Arne Brutschy <abr-r-project at xylon.de> wrote:
>> Hello,
>>
>> I'm currently using a simple plot to visualize some mean values. I'm
>> having ~200 datapoints on the x-axis, each has 10 records. I'm
>> currently plotting only the mean value of each of the datapoints.
>>
>> What I need is a way to visualize the quartiles/error/whatever of
>> these points. I thought about boxplots, but I have to many points on
>> the xaxis - it would be impossible to see anything. I though that it
>> would be nice to have a "hull" around each line, indicate the width of
>> the quartiles, visualized by a different background. It's like a very
>> wide boxplot with a changing mean value...
>>
>> Is this possible with r? Does anyone know what I mean and/or has done
>> this before?
>>
>> Thanks
>> Arne



More information about the R-help mailing list