[R] Color & pch functionalities in dotchart()

GINGINS Simon simon.gingins at unine.ch
Tue Nov 3 14:58:04 CET 2015


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

More information about the R-help mailing list