[R] ggplot2 qplot pch not working anymore

Stephen Sefick ssefick at gmail.com
Wed Jul 18 06:10:41 CEST 2012


Dr. Bolker thank you for the help.  I have figured out how to make this 
do what I wanted - re:inline.  I wanted to use the pch variable as the 
number for the R plotting symbol.  I hope that makes more sense.
kindest regards,

Stephen

On Tue 17 Jul 2012 10:31:07 PM CDT, Ben Bolker wrote:
> Stephen Sefick <sas0025 <at> auburn.edu> writes:
>
>
>> I'm sorry I didn't give the correct code, or explaination;  the
>> shape=pch doesn't work anymore.  For example this used to work, but no
>> longer can accept continuous values:
>>
>> #example code
>> a <- 1:10
>> b <- 1:10
>> pch <- 1:10
>>
>> q <- data.frame(a,b,pch)
>>
>> qplot(a,b, shape=pch)
>

if you change  the above line of code to

qplot(a,b, shape=pch)+scale_shape_identity()


>    Not entirely clear what you want it to do: how *would* you
> map a continuous variable onto shape (assuming you're not
> using something like Chernoff faces)?  Does
>
> qplot(a,b,shape=factor(pch,levels=1:10))
>
> do what you want?
>

I will have a look at these soon.

> A couple of possibly useful recent Stack Overflow posts
> (URLs broken):
>
> http://stackoverflow.com/questions/10002627/
> ggplot2-0-9-0-automatically-dropping-unused-factor-levels-from-plot-legend
>
> http://stackoverflow.com/questions/11361404/
> consistent-legend-colors-with-qplot
>
>
>
>
>> many thanks,
>>
>> Stephen Sefick
>>
>> On 07/17/2012 07:28 PM, Stephen Sefick wrote:
>>> Is there a way to use a continuous variable to pch in qplot?  I
>>> believe this worked in previous version.  I need to specify certain
>>> values of a shape for particular points so that multiple graphs all
>>> show the same shapes for the same streams.  I have gone to the
>>> original data and added a pch column that I would like to use to
>>> specify the shapes to pch in qplot.  Any help would be greatly
>>> appreciated.
>>>
>>> #example code
>>> a <- 1:10
>>> b <- 1:10
>>> pch <- 1:10
>>>
>>> q <- data.frame(a,b,pch)
>>>
>>> qplot(a,b, pch=pch)
>>>
>>> Many thanks,
>>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list