我对我的豆图和传说有疑问。我找不到办法做事情
viewDidLayoutSubviews()
到communication_focused
)communication-focused
(每个类别中的黑色实线)颜色这是我的代码:
mean
我的数据集:
beanplot(onset_s~ group*meaning, data=mu3,ll = 0.08,
main = "Distribution of movement units", side = "both",
col = list("black", c("grey", "white")),
axes=T, beanlines = "median")
legend("topleft",fill = c("grey", "black"), legend = c("Non-Performers", "Experts"), cex=0.65)
这是我的图表:
非常欢迎任何反馈和评论!
提前谢谢。
答案 0 :(得分:2)
好吧,我已经玩了一段时间了,除了改变mean
行的颜色之外,我已经设法回答了你的所有问题。 col =
函数中beanplot()
争论的设置对我来说似乎有点挑剔。但是,这就是我对其他一切所拥有的:
par(xpd=F, mai = c(1, 1, 1, 2))
beanplot(onset_s~ group*meaning, data=df,ll = 0.08,
main = "Distribution of movement units", side = "both",
col = list("black", c("grey", "white")),
axes=F, beanlines = "median", ylim = c(-5, 15)) #axes = F let's you define your own axes
#now you can define the x and y axes like this
#note - this also takes care of your renaming issue
#although you could just change the character values using subsetting
#axis 1 is the x axis
axis(1, at = 1:3, labels = c("communication-focused", "context-focused", "self-focused"))
#axis 2 is the y axis, and you can change the values in the "at =" vector
axis(2, at = c(-5, -2.5, 0, 2.5, 5, 7.5, 10, 12.5, 15))
#this creates the outer box around the plot, which is removed with axes = F
box(which = "plot")
#This now lets you add things to the graphic system outside of the plotting area
par(xpd=TRUE)
#you will need to change the x and y coordinates
#also, the "cex =' arguement of the legend function controls
#the size of the text, so by setting this equal to one, you achieve larger text
legend(3.7, 15.8,fill = c("grey", "black"), legend = c("Non-Performers", "Experts"), cex=1)
现在,我在col =
中的beanplot
参数中尝试了多种不同的组合来修复您的平均线问题。然而,我得到的最接近的是将该线变为红色但随后摆脱了每个豆的分割设置。我认为您应该使用不同的组合,并在?beanplot
帮助页面中阅读该特定参数的说明。
无论如何,我希望这有帮助
UPDATE 我已将mai = c()
参数添加到par()
的第一个函数调用中。此参数允许您通过以英寸为单位指定每个相应边距的边距大小(按从下,左,上,右的顺序)来控制绘图周围的边距。这应该可以解决您的问题。我添加了图形图像以显示当前的样子: