我有一个很长的扩展代码,我用图表创建了它,显示了重叠的行。
你能提出一些建议来理清这个问题,使复制更清晰吗?也许有其他的选项来修改图形本身的大小?
例如,当使用ggsave
保存图形时。谢谢
联系我们
这里是我正在处理的数据集
df = structure(list(ANT = c("MEDIUM", "MEDIUM", "MEDIUM", "LOW", "LOW",
"LOW", "HIGH", "HIGH", "HIGH"), BUT = c("flat", "tighted", "curved",
"flat", "tighted", "curved", "flat", "tighted", "curved"), var = c("sighted",
"sighted", "sighted", "sighted", "sighted", "sighted", "sighted",
"sighted", "sighted"), mean = c(24.9795700007983, 22.5476640156841,
24.4568444611505, 24.4608952261011, 22.179843452558, 25.1211893108135,
24.1807279709165, 21.9700173259632, 25.5690587972475), low = c(24.1929993862564,
22.0173613402898, 23.7793134256169, 23.5748441551253, 21.2709153846706,
24.2111126105412, 23.376952383782, 21.3272260871708, 24.7053231240633
), up = c(25.7661406153403, 23.0779666910784, 25.1343754966842,
25.3469462970768, 23.0887715204454, 26.0312660110858, 24.984503558051,
22.6128085647556, 26.4327944704316)), row.names = c(NA, -9L), class = c("tbl_df",
"tbl", "data.frame"))
从中获取统计信息标签的表
val = structure(list(group1 = c("flat", "flat", "tighted", "flat",
"flat", "tighted", "flat", "flat", "tighted"), group2 = c("tighted",
"curved", "curved", "tighted", "curved", "curved", "tighted",
"curved", "curved"), y.position = c(45.985, 48.4375, 50.89, 53.985,
56.4375, 58.89, 58.493, 60.9455, 63.398), lab = c("0.0132 - *",
"0.585 - ns", "0.0494 - ns", "0.0826 - ns", "0.618 - ns",
"0.0214 - ns", "0.0458 - ns", "0.211 - ns", "0.00171 - **"
)), row.names = c(NA, -9L), class = c("tbl_df", "tbl", "data.frame"
))
我使用的代码
library(ggplot2)
library(ggpubr)
ggplot(df,
aes(x= BUT, y= mean,
colour= ANT, group = ANT)) +
geom_errorbar(aes(ymin= low,
ymax= up),
colour="black", width=.10) +
geom_line() +
geom_point(size= 3, shape= 21, fill="white") +
stat_pvalue_manual(
val,
step.increase=0.05,label = "lab")
1条答案
按热度按时间edqdpe6u1#
这不是我解决问题的方式-我会从情节中排除不重要的相互作用以“整理”事情-但这里是对你问题的回答:
创建于2023-04-28带有reprex v2.0.2
如果你只想在图上绘制重要项,你可以这样做:
创建于2023-04-28带有reprex v2.0.2
这种方法是否适用于您的用例?