借给 ggplot2 等价的参数?
lend argument equivalent for ggplot2?
在 ggplot2
中是否有一个等效的参数用于基础 R 中的 lend
参数,可以让你为你的线条制作圆角边缘?
我有一个线条很粗的图,我想让边缘变圆...
Rounding the edges of lines seems to be default in base R,但我不知道如何用ggplot
复制它:
df = structure(list(x = c(10, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8,10.9), y = c(282.083195814139, 281.463374904196, 280.846027959358,280.231142308826, 279.618705353623, 279.008704566105, 278.401127489482, 277.795961737318, 277.193194993064, 276.592815009577)), .Names = c("x", "y"), row.names = c(NA, 10L), class = "data.frame")
ggplot(df, aes(x, y)) + geom_line(lwd = 10)
lend
参数在这里没有用。
ggplot(df, aes(x, y)) + geom_line(lwd = 10, lend=0)
您需要使用 geom_path。参数是lineend.
ggplot(df, aes(x, y)) + geom_path(lwd = 10, lineend = "round")
在 ggplot2
中是否有一个等效的参数用于基础 R 中的 lend
参数,可以让你为你的线条制作圆角边缘?
我有一个线条很粗的图,我想让边缘变圆...
Rounding the edges of lines seems to be default in base R,但我不知道如何用ggplot
复制它:
df = structure(list(x = c(10, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8,10.9), y = c(282.083195814139, 281.463374904196, 280.846027959358,280.231142308826, 279.618705353623, 279.008704566105, 278.401127489482, 277.795961737318, 277.193194993064, 276.592815009577)), .Names = c("x", "y"), row.names = c(NA, 10L), class = "data.frame")
ggplot(df, aes(x, y)) + geom_line(lwd = 10)
lend
参数在这里没有用。
ggplot(df, aes(x, y)) + geom_line(lwd = 10, lend=0)
您需要使用 geom_path。参数是lineend.
ggplot(df, aes(x, y)) + geom_path(lwd = 10, lineend = "round")