在boxplot中标记散点图点,并在R中的图形中标记boxplot的摘要 [英] Labeling the scatterplot point in boxplot And the summary of the boxplot in the graph in R

查看:897
本文介绍了在boxplot中标记散点图点,并在R中的图形中标记boxplot的摘要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bonjour全部

我需要帮助以找到在散点图中标记散点图的解决方案.

I need help to find a solution to labeling the scatterplot in boxplot.

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

As you can see below, there is two data, first is the data of all macrocosmes, and second is the mean each macrocosmes.

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

means
1 15.43801 15.38659 15.23252 15.50707 15.67684 15.25383

我的问题是,如何在图形的两个点中显示标签.我想在每个点上标注其编号.

My problem is, how to show the label in each point in the graph two. i want to labeling each point with their 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()->不显示任何内容

I have tried with function text() --> show the number in the boxplot not in the scatterplot, and package textxy() --> not show anything

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

I guess there is a problem when i determine the x,y values.. hmm.. Is there possible, that we show the summary of each boxplot in the graph (median, Q1 -Q3)?

这是我产生的图形: 如下图所示,有两个图形,右侧是所有均值的宏观图的箱线图,左侧是均值均是散点图的箱线图.

This is the graph that i produce : As you can see below, there is two graphs, the right side is the boxplot of all macrocosmes with the mean values, and the left side is the boxplot with scatter plot of all mean the macrocosmes.

谢谢您的帮助.

此致

Yougyz

推荐答案

文本函数应该可以找到.例如

The text function should work find. For example,

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

在您的示例中,尝试类似以下操作:

In your example, try something like:

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

这应该在红点处显示字母.但是,在调用带状图功能时,您已经抖动"或摆动"了这些点.由于您只有几点,所以请不要抖动它们(可能忽略method参数),并且应该可以进行以下操作:

This should display letters at the red dots. However, in your call to the strip chart function, you have "jittered" or "wiggled" the points. Since you've only a few points, don't jitter them (probably omit the method argument), and the following should work:

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

这篇关于在boxplot中标记散点图点,并在R中的图形中标记boxplot的摘要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆