【发布时间】:2018-01-15 20:44:43
【问题描述】:
我有以下数据框
View(d.df)
Statements | Score | Time
-----------+-------+------
Need Ex |4.159 | T1
Need Ex |3.714 | T2
Interest |2.937 | T1
Interest |3.508 | T2
和我的阴谋
ggplot(data=d.df, aes(x=`Time`,y=Score, fill=`Time`)) +
geom_bar(stat="identity") +
scale_fill_manual(values=c("red","blue"))+
facet_wrap(~Statements)
生成正确的图形,但 Y 轴刻度不从零开始。我希望 Y 轴从零变为 4.5。 我尝试添加
+ scale_y_continuous(limits=c(0.0,4.5))
但我收到一条错误消息:
Error: Discrete value supplied to continuous scale
如果我尝试
+ coord_cartesian(ylim=c(0,4.5))
坐标几乎保持不变(在底部添加了一些填充)。 关于如何让我的轴与这些数据成比例地从 0 到 4.5 的任何想法?
【问题讨论】:
标签: r ggplot2 coordinates