1

万事如意,

我需要帮助来找到在箱线图中标记散点图的解决方案。

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

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))

我尝试过使用函数 text() --> 在箱线图中显示数字而不是在散点图中,并且包 textxy() --> 不显示任何内容

我想当我确定 x,y 值时会出现问题.. 嗯.. 是否有可能,我们在图中显示每个箱线图的摘要(中值,Q1 -Q3)?

这是我制作的图表:如下所示,有两个图表,右侧是所有宏观宇宙平均值的箱线图,左侧是所有宏观宇宙平均值散点图的箱线图。

我的带有箱线图的图表和带有一维散点图的所有箱线图的平均值 之前谢谢你的帮助。。

问候,

尤吉兹

4

1 回答 1

1

文本功能应该可以找到。例如,

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)
于 2012-04-03T12:51:21.657 回答