我想为包含正值和负值的数据框绘制条形图,负值应为红色。
我想避免使用 ggplot 而使用基本的 'barplot'
有什么建议吗?
这是我的代码
df <- data.frame(MM=(1:12), value=rnorm(12))
df
toplot <- df
options(repr.plot.width=6, repr.plot.height=4)
label <- seq(1:12)
a <-barplot(df$value,
names=label,
col='deepskyblue3',
xaxt = "n", yaxt = "n",
)
axis(1, cex.axis=0.55, las=1, at=a, labels=label)
axis(2, las='2', cex.axis=0.6)
abline(h = 0, col = "black")
相关文章:
javascript - 是否所有 WebAPI 都被推送到任务队列中?
amazon-web-services - AWS CodePipeline 角色无权在阶段的 "a
jooq - jooq record 取数据时是否使用列索引?
swift - 我们如何在 SwiftUI 中制作自定义 GeometryReader?
angular - 检测关闭浏览器 Angular 12 的事件
node.js - 在不使用 NVM for Windows 的情况下在 Windows 上安装多个
android - 加载 flutter 时去除图像中的白色闪烁
json - 通过 Postman 使用 PUT 请求更新 Contentful 帖子