我對情節的第二列有疑問。錯誤欄顯示不完整。有辦法解決這個問題嗎?我需要情節完全如下。這是示例代碼和結果。謝謝。
ggplot(data, aes(x = reorder(Treatment, -mean), y = mean, fill = Grapevine))
geom_col(aes(x = reorder(Treatment, -mean), y = mean),
stat = "identity", position = "dodge"
)
geom_errorbar(aes(
x = reorder(Treatment, -mean), ymin = mean - se,
ymax = mean se
),
width = 0.1,
position = position_dodge(0.9)
)
scale_y_cut(breaks = c(2.0E-09, 2.0E-08, 1.0E-07))
scale_y_continuous(breaks = c(0, 6.0e-09, 6.0e-08, 6.0e-07))
theme(
line = element_line(
colour = "black", size = 1,
linetype = 1, lineend = "butt"
),
rect = element_rect(
fill = "white", colour = "black",
size = 1, linetype = 1
),
aspect.ratio = 0.6,
plot.background = element_rect(fill = "white"), plot.margin = margin(1, 1, 1, 1, "cm"), axis.text = element_text(size = rel(2.5), colour = "#000000", margin = 1), strip.text = element_text(size = rel(0.8)), axis.line = element_blank(), axis.text.x = element_text(vjust = 0.2, angle = 90), axis.text.y = element_text(hjust = 1), axis.ticks = element_line(colour = "#000000", size = 1.2), axis.title.x = element_text(size = 30, vjust = 0.5), axis.title.y = element_text(size = 30, angle = 90), axis.ticks.length = unit(0.1, "cm"), legend.background = element_rect(colour = NA), legend.margin = unit(0.15, "cm"), legend.key = element_rect(fill = "grey95", colour = "white"), legend.key.size = unit(1.2, "lines"), legend.key.height = NULL, legend.key.width = NULL, legend.text = element_text(size = rel(2.0)), legend.text.align = NULL, legend.title = element_text(size = rel(2.0), face = "bold", hjust = 0), legend.title.align = NULL, legend.position = "right", legend.direction = NULL, legend.justification = "right", legend.box = NULL, panel.background = element_rect(
fill = "#ffffff", colour = "#000000",
size = 2, linetype = "solid"
), panel.border = element_rect(colour = "black", fill = NA, size = 2),
)
ylab(expression(Lp[r] ~ (m ~ s^-1 ~ Mpa^-1)))
xlab(expression(Treatment))
uj5u.com熱心網友回復:
我們可以用 明確設定繪圖的限制lims()
,但在這種情況下,使用它會更優雅,expand_limits()
它會自動調整限制以確保某個值在繪圖中可見。
例子:
ggplot(...)
geom_point()
expand_limits(y = 8.5e-7) # a manually hardcoded location
ggplot(...)
geom_point()
expand_limits(y = max(data$mean data$se) ) # a limit based on your actual data
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/498299.html
下一篇:在ggplot2中剪輯的注釋標簽