Tuesday, 27 August 2013

R programming - creating a graph, with variable colors

R programming - creating a graph, with variable colors

I do not have much experience in R, and I wonder if they can help me in
this situation.
I have the following matrix:
mat <-
matrix(c(0,0.5,0.2,0.23,0.6,0,0,0.4,0.56,0.37,0,0.32,0.4,0.99,0.54,0.6,0,0.39),
ncol=6, nrow=3)
dimnames(mat) = list( c("y1","y2","y3"),
c("day1","day2","day3","day4","day5","day6"))
> mat
day1 day2 day3 day4 day5 day6
y1 0.0 0.23 0.00 0.37 0.40 0.60
y2 0.5 0.60 0.40 0.00 0.99 0.00
y3 0.2 0.00 0.56 0.32 0.54 0.39
>
I want to know how can I get a graph where points would be marked based on
the matrix.
The values &#8203;&#8203;are arbitrary in the interval [0,1]. It is
possible to change the color of the generated points as a set of
constraints?
Example:
[0,0.2] - Red
[0.2,0.4] - Green
[0.5,0.6] - Yellow
[0.6,0.9] - Blue
[0.9,1] - Black
I apologize if I have not explained myself well.
Thank you!

No comments:

Post a Comment