alpha scale

25 views
Skip to first unread message

Dr Proteome

unread,
Jun 30, 2010, 7:36:01 AM6/30/10
to ggplot2
Hi,
Sorry to bother you with this, but I can't get this to work...
I've performed curvefits.... and now I would like to have the Rquare
(quality) of the fit as an alpha in the plot (facet wrap, on plot per
graph)...
Of course ggplot nicely devides the alpha scale over all the Rsqares
in the dataset, while I just want only curves with an Rsqure>0.6 to
starting to become visible (for Rsquare < 0.6 alpha should be 0)

for that I used scale_alpha(limits=c(0.6,1))... this works fine if
you only have Rsquare values within the 0.6-1 range and the scale is
nicely stretched.

However, when you include curves with Rsquare < 0.6 it returns:
Error in rgb(col[1, ], col[2, ], col[3, ], col[4, ]) :
alpha level nan, not in [0,1]

obviously because there is Rsquare data outside of the range...

how can I get this to work?... I tried tot do something with
'breaks'... but failed..

thanks!

Rene

Hadley Wickham

unread,
Jun 30, 2010, 9:39:31 AM6/30/10
to Dr Proteome, ggplot2
Hi Rene,

Can you please include a reproducible example? (http://gist.github.com/270442)

Hadley

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

Dr Proteome

unread,
Jul 1, 2010, 4:40:24 AM7/1/10
to ggplot2
hope this helps?

my output contains the results from a curvefit of 4 drug dose-response
curves
estimated logEC50 (drug potency) and R2 (quality of the fit) are
given:

output=data.frame(
drug=c('A','B','C','D'),
logEC50=c(-9.6, -9.4, -4.8, -8.3),
R2=c(0.99, 0.76, 0.22, 0.89))

to compare the drug potencies I would use:
ggplot(output, aes(drug, -logEC50)) +
opts(title='comparison of dug potencies') +
geom_point(size=4)


which plots all the data.
now I would like to include the R2 data to get a feeling for the
quality of the data:

ggplot(output, aes(drug, -logEC50, alpha=R2)) +
opts(title='comparison of dug potencies') +
geom_point(size=4)

I am however only interseted in 'high-quality' data (R2>0.6) and
woult like to 'stretch'
the whole alpha scale 'spanning' only the range 0.6 to 1 (and
everything below 0.6 should be
invisible)

so I try:
ggplot(output, aes(drug, -logEC50, alpha=R2)) +
opts(title='comparison of dug potencies') +
geom_point(size=4) +
scale_alpha(limits=c(0.6,1))

and I get this:
>Error in rgb(col[1, ], col[2, ], col[3, ], col[4, ]) :
>alpha level nan, not in [0,1]


how can I solve this?


your help is much appreciated!

R

Hadley Wickham

unread,
Jul 3, 2010, 8:48:30 AM7/3/10
to Dr Proteome, ggplot2
This will be fixed in ggplot 0.8.9.

Hadley

Reply all
Reply to author
Forward
0 new messages