Senlin Liang wrote:

I have a file with 3 cols as:
x    y    value
1    1    0.5000
1    2    1.8333
1    3    4.3333
2    1    0.7500
2    2    0.7500
2    3    4
3    1    0.7500
3    2    1.4167
3    3    5.1667

I read them in using
p <- read.table("data.txt", header=TRUE)

My questoin: how to draw a image to show the values at different positions
(x, y)? I would like to see different colors for different values.
Hi Senlin,
Try this:

library(plotrix)
plot(p$x,p$y,
 col=color.scale(p$value,extremes=c("green","red"))

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to