r - ggplot - 比例堆积面积图
问题描述
我不明白为什么我的比例堆积面积图不工作。当我使用以下代码时,我会看到这种奇怪的倾斜视觉效果:
ViolentCrimes <- ddply(ViolentCrimes, "Year", transform, PercentofTotal = Number_of_Crimes/sum(Number_of_Crimes) * 100)
ggplot(ViolentCrimes, (aes(x = Year, y = PercentofTotal, fill = Crime_Type)) +
geom_area() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
ylab("Percent of Total")`
但是当我将 geom_area 更改为 geom_bar 并添加 stat="identity" 时,条形图似乎工作得很好,即使它很难阅读(这就是我想要比例面积图的原因):
任何帮助表示赞赏 - 非常感谢你。
解决方案
推荐阅读
- docker - 如何设置 DOCKER_HOST?
- javascript - 如何从生成器函数中的回调函数调用 redux-saga 效果?
- apache-nifi - NiFi - 停止处理器后线程仍然运行
- kubernetes - Kubernetes 跨命名空间入口网络
- c# - 如何解析 JSON 数据以生成演示请求正文对象创建的 C# 示例代码
- android - 存储库仅作为与数据层的通信?
- visual-studio-2015 - 如何通过变量更改连接管理器中的服务器名称
- nginx - 在 nginx 中创建代理
- javascript - CSS 转换迫使 Safari 重新加载页面
- python - Python 脚本不会像应有的那样将 SQL 查询的结果写入平面 JSON 文件