由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - quick question in R
相关主题
在R里想做这个效果的图SAS plot question
adding colors to data points in scatter plot in R如何做microarray的scatter plot图?
[合集] 请教一个统计问题data prediction by regression or better ways
为什么不能把ABLINE加到散点图中了PCA作图
请教一个r的问题一般什么样的数据,分析起来要做log transformation?
R: how to convert a scatter plot to a contour color plot?求助:pairs plot in R
How to plot multi-curves in one single chart by R请教大家一个关于check normality的问题
求助--基因之间表达量回归分析软件关于R做图的问题,大家有什么好的方法啊(和matlab比较)
相关话题的讨论汇总
话题: col话题: data话题: matrix话题: legend话题: color
进入Statistics版参与讨论
1 (共1页)
p*****o
发帖数: 543
1
when i use pairs to plot the scatter plot, i used "col= " option to
differentiate 4 different groups. but in the output picture, how can i ask R
to write the legend of each color on it, indicating which color reflects
which group.
thank you so much
p*****o
发帖数: 543
2
thanks a lot but actually i didnt quite get it. Actually following is the
statement i wrote in R to create the plot. But i wish to have description
for each color in the picture.
pairs(Data_Matrix[,2:7],pch=22,col=Data_Matrix[,8])
R create the color automatically for me and I even dont know which color indicates each group (but sure, i can check that in the data set, but just wondering whether there is a way to do that automatically in R)
Thanks a lot
w*****n
发帖数: 375
3
col=Data_Matrix[,8] is equivalent to col = as.factor(Data_Matrix[,8])
you can use
pairs(Data_Matrix[,2:7],pch=22,col= c("black", "green", "red", "blue"))

indicates each group (but sure, i can check that in the data set, but just
wondering whether there is a way to do that automatically in R)

【在 p*****o 的大作中提到】
: thanks a lot but actually i didnt quite get it. Actually following is the
: statement i wrote in R to create the plot. But i wish to have description
: for each color in the picture.
: pairs(Data_Matrix[,2:7],pch=22,col=Data_Matrix[,8])
: R create the color automatically for me and I even dont know which color indicates each group (but sure, i can check that in the data set, but just wondering whether there is a way to do that automatically in R)
: Thanks a lot

p*****o
发帖数: 543
4
actually I tried and then use the legend statement:
legend(0.1,0.1,legend=c('Cluster1','Cluster2','Cluster3'), col=c("yellow","
green","red"))
but still didnt see the legend...not sure where I messed it up...

【在 w*****n 的大作中提到】
: col=Data_Matrix[,8] is equivalent to col = as.factor(Data_Matrix[,8])
: you can use
: pairs(Data_Matrix[,2:7],pch=22,col= c("black", "green", "red", "blue"))
:
: indicates each group (but sure, i can check that in the data set, but just
: wondering whether there is a way to do that automatically in R)

w*****n
发帖数: 375
5
panel.tt <- function(x, y, labels, cex, font, ...)
{
legend(median(x), median(x), c('Cluster1','Cluster2','Cluster3'),
col=c("yellow","green","red"),
pch = c(1))
}
pairs(mm[1:3, 2:4], diag.panel = panel.tt, col = c("yellow","green","red") )

【在 p*****o 的大作中提到】
: actually I tried and then use the legend statement:
: legend(0.1,0.1,legend=c('Cluster1','Cluster2','Cluster3'), col=c("yellow","
: green","red"))
: but still didnt see the legend...not sure where I messed it up...

1 (共1页)
进入Statistics版参与讨论
相关主题
关于R做图的问题,大家有什么好的方法啊(和matlab比较)请教一个r的问题
plot in RR: how to convert a scatter plot to a contour color plot?
[R问题]how to make matrix from list (or the other way around)How to plot multi-curves in one single chart by R
关于基因表达的统计学问题, 不知发这是否合适求助--基因之间表达量回归分析软件
在R里想做这个效果的图SAS plot question
adding colors to data points in scatter plot in R如何做microarray的scatter plot图?
[合集] 请教一个统计问题data prediction by regression or better ways
为什么不能把ABLINE加到散点图中了PCA作图
相关话题的讨论汇总
话题: col话题: data话题: matrix话题: legend话题: color