标签: r ggplot2 geom-bar
作为一个简单的示例,我将使用菱形数据:
data(diamonds) ggplot(diamonds, aes(x = clarity, y = carat, fill = cut)) + geom_bar(stat = "identity")
这将为我提供以下输出,其中未标注x轴:
如何显示x和y轴的值?我一直在搜寻,而且还没有找到解决方法...
对于我的真实数据集,我的x轴值是离散的,并且使用scale_x_discrete()不会更改结果。
提前谢谢!
答案 0 :(得分:0)
您的代码工作正常,我相信您必须更新ggplot2并开始一个新的R会话:
ggplot2
R