[R] dotchart for matrix data

David Winsemius dwinsemius at comcast.net
Wed Jan 5 15:46:10 CET 2011


On Jan 5, 2011, at 8:11 AM, e-letter wrote:

> Readers,
>
> The following commands were applied, to create a dot chart with black
> dots and blue squares for data:
>
>> library(lattice)
>> testdot
>  category values
> 1        b     44
> 2        c     51
> 3        d     65
> 4        a     10
> 5        b     64
> 6        c     71
> 7        d     49
> 8        a     27
>
> dotplot
> (category
> ~
> values
> ,col
> =
> c
> ("black
> ","black
> ","black
> ","black
> ","blue
> ","blue
> ","blue
> ","blue
> "),bg
> =
> c
> ("black
> ","black
> ","black
> ","black
> ","blue
> ","blue","blue","blue"),pch=c(21,21,21,21,22,22,22,22),xlab=NULL,
> data=testdot)
>
> The resultant graph shows correctly coloured points, but not filled,
> only the border is coloured. The documentation for the command 'pch'
> (?pch) indicates that the commands shown above should show
> appropriately coloured solid symbols. What is causing this error
> please?

There is no pch command. It is a graphical parameter. If you are  
looking at the "points" help page then you are not looking at  
documentation that necessarily applies to a lattice function like  
dotplot. After first looking at ?dotplot, then ?panel.dotplot,  and  
then because it says the points are done with panel.xyplot, my guess  
is that you need to add a fill =TRUE or a fill= <color-vector> option.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list