[R] Color & pch functionalities in dotchart()

Bert Gunter bgunter.4567 at gmail.com
Tue Nov 3 16:42:11 CET 2015


Look at your code!

color was specified as "as.factor..."
and pch was specifed as "..." (no as.factor() )

Read an R tutorial on how factors are coded for why this would make a
difference.

-- Bert


Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Tue, Nov 3, 2015 at 5:58 AM, GINGINS Simon <simon.gingins at unine.ch> wrote:
> Hi,
>
> I am currently building graphs using dochart(). I plotted the points in two different colors according to specific criteria from my dataset. Later, I decided to also give them different symbols, for easier reading if printed. I got quite a surprise when I realized that, even though I gave the same variable to both color= and pch= , I got a mix of the colors and symbols. I wanted one type of symbol to be only one color, and the second only the other color, and it is clearly not what happened. From my data, I would say that the pch= argument is not dealing properly with the variable I gave it. I tried using a dataset from R to see if this was only in my dataset, and it did the same. here’s a reproducible example, using beaver1:
>
> dotchart(beaver1$temp, groups=factor(beaver1$day), color=as.factor(beaver1$activ), pch=beaver1$activ)
>
> Does anyone know why, with the same variable, the arguments color & pch give different results?
>
> That would be of great help, since now I am no longer sure which one isthe correct representation of my data.
>
> Best regards & many thanks for the help
>
> Simon Gingins
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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