# [R] Split plot in colors/pch??

Petr Pikal petr.pikal at precheza.cz
Fri Mar 1 14:27:02 CET 2002

```If I understand it correctly you want to plot variable y against
variable x but with plotting characters or colours coded by z
values.

I usually use this construction

plot(daf\$x,daf\$y,type="n")

followed by

points(daf\$x, daf\$y, pch=daf\$z, col=daf\$z)

if z has reasonable values }integer 1:7

or construction with for loop

for (i in 1:n) points(daf\$x[selection according i],, daf\$y[sel......],
pch=i, col=i)

and sometimes matplot is quite convenient (see help pages).

Meanwhile for good graphic tricks I usually consult StatsRus

http://lark.cc.ukans.edu/~pauljohn/R/statsRus.html

On 1 Mar 2002 at 11:28, Fredrik Karlsson wrote:

> Hi all
>
> This seems like a very easy question, but I have not found a simple
>
> If you have a dataframe, how to you plot two of then in different
> colors depending on a third variable?
>
>
> All help appreciated!
>
> /Fredrik
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.- r-help mailing list -- Read
> http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help",
> or "[un]subscribe" (in the "body", not the subject !)  To:
> r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> _._._._._

Petr Pikal
petr.pikal at precheza.cz
p.pik at volny.cz

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```