I'm trying to plot the VALUE
column and then label them with the LABEL
column
X VALUE LABEL COLOR
1 78 T041N2 3
2 77 T018N3 2
3 97 T014N3 1
4 0 T149N4 1
5 62 T043N1 3
6 66 T018N3 3
7 56 T145N4 3
8 63 T019N4 1
9 82 T039N0 1
10 75 T018N3 1
11 76 T018N3 1
12 63 T043N1 2
13 0 T149N4 2
14 73 T019N4 2
15 77 T019N4 3
16 100 T149N4 3
17 92 T043N1 3
I read the data then plot the VALUE
data and then put the LABEL
labels with the text command using the following code and works fine
my_data <- read.table("mydata.dat", header=T, sep="\t")
plot(my_data$VALUE, type="o")
text(my_data$VALUE, y = NULL, labels = my_data$LABEL, adj = NULL,pos = 3, offset = 0.5, vfont = NULL,cex = 0.5, col = NULL, font = NULL)
But now I was asked to paint each data point (that now are just black circles) according to the COLOR
vector (1 is red, 2 is green and 3 is yellow).
How could I paint the points according to that COLOR
vector?