Pregunta

I have a matrix

B = matrix(c(1,2,4,1,4,2,1,3.5,4.2,2,2.2,6.5,3,1.2,7.7,1,2.1,1.6,3,5.2,8.2),
           nrow = 7)

with 3 columns: the color column (colors from 1-5, representing blue,red,green,yellow,black), the x column and the y column.

I want to plot every points (x,y) with the color from the color column.

First question: what software is best to do so?

Second question: how can I do it with R?

¿Fue útil?

Solución

Simple question finds simple answer:

plot(B[,2], B[,3], col=c("blue","red","green","yellow","black")[B[,1]])
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top