2012-04-03 164 views
1

卓悦的所有汇总,标注在箱线图散点图点和箱线图中的曲线图中的R

我需要帮助找到一个解决方案来标注在箱线图散点图。

如下图所示,有两个数据,第一个是所有宏观数据,第二个是每个宏观数据的平均值。

TAB1 //查询结果

 1  2  3  4  5  6 
1 13.2089 13.3161 13.2497 13.2268 13.2209 11.6036 
2 13.2923 13.3869 13.2950 13.2876 13.2922 11.7044 
3 13.4493 13.5394 13.4450 13.4735 13.4689 11.9483 

意味着
1 15.43801 15.38659 15.23252 15.50707 15.67684 15.25383

我的问题是,如何显示在每个点上的标签图二。我想用他们的no.macrocosme标记每个点。

这是我的一点代码:

#Macrocosme 
Mac = svalue(cbMacro) 

#Add boxplots to all Macs 
par(mfrow = c(1, 2)) 
boxplot(Tab1, main="Temperature of Macrocosme", xlab="No. Macrocosme", ylab="Temperature in Celcius", col=(c("gold","darkgreen")),ylim=range(c(min(vmin),max(vmax)))) 
points(1:length(Mac), means,pch = 22) 

#Add boxplots to a median of all Macs 
boxplot(means, main="Mean Temperature of all the Macrocosme", xlab="Mean", ylab="Temperature in Celcius") 
with(Tab1, stripchart(means, method="jitter", vertical=TRUE, add=TRUE, col="red",pch = 20)) 

我与功能文本()尝试 - >显示包textxy(在箱线图不是在散点图的数量,) - >没有显示任何东西

我估计有一个问题,当我确定x,y值..嗯..是否有可能,我们显示图中每个boxplot的总结(中位数,Q1 -Q3)?

这是我生成的图表: 正如您在下面看到的,有两个图表,右侧是所有大观框的平均值框图,左侧框图是散点图意味着宏观世界。

My Graph with boxplot and mean of all boxplot with 1-D scatterplot 之前感谢您的帮助..

问候,

Yougyz

回答

1

TEXT函数应该工作找到。例如,

R> x = rnorm(10) 
R> boxplot(x, ylim=c(-3, 3)) 
R> text(1, 1, "Hi", col=2) 

在你的榜样,你可以试试:

text(1, means, LETTERS[length(means)], col=2) 

这应该显示在红点字母。但是,在您呼叫条形图功能时,您已经“抖动”或“摆动”了点。既然你只有几点,不要抖动他们(可能省略方法参数),并且以下应该工作:

text(1.3, means, LETTERS[length(means)], col=2)