R - ggplot - geom_bar 的圆形末端

标签 r ggplot2 geom-bar

这是我的条形图外观的简单示例:

x <- data.frame(aa=c(0.2,0.6,0.1), dd = c(1,2,3))
x <- melt(x, "dd")
y <- data.frame(bb=c(0.4,0.5), dd = c(1,2))
y <- melt(y, "dd")
z <- data.frame(cc=c(0.5,0.25,0.1,0.05), dd = c(1,2,3,4))
z <- melt(z, "dd")

x=rbind(x,y,z)

col=c("white","grey","blue","white","red","white","green","blue","green")
ggplot(x, aes(x = variable, y = value)) + geom_bar(stat = "identity", fill = col)

我想知道是否有办法为我的酒吧设置圆形末端,就像线条的 lineend 选项( http://sape.inf.usi.ch/quick-reference/ggplot2/lineend )?

最佳答案

这是一个示例,其中钢筋具有圆形末端,与 一起使用geom_line (geom_path),作为一个最小的例子。

df1 <- data.frame( x=c(1,1,2,2,3,3),
                   y=c(1,7,1,4,1,5),
                   chr=c("one","one","two","two","three","three") )

ggplot( df1, aes(x,y, col=chr) ) + geom_line( lineend="round", lwd=10 )
ggplot_geom_line

关于R - ggplot - geom_bar 的圆形末端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29846076/

相关文章:

r - geom_bar() 和 geom_col() 的所有位置是什么?

r - 如何在 R 中创建线性维恩图?

r - 将多个数据帧复制到 R 中的 SQLite 数据库

r - 在世界地图上叠加多个河图(桑基图)

r - ggplot2 - 创建一个关于总样本大小的堆积密度图

r - ggplot2比例x日期?

r - 如何使用 R-ggplot2 区分条形图中的不同组(除了使用填充颜色)

R代码将shiny.tag.list保存到html,就像查看器->导出->另存为网页按钮一样

r - 根据 x & y 的乘积将圆段添加到 ggplot