【问题标题】:Creating histogram on R在 R 上创建直方图
【发布时间】:2015-11-12 19:36:33
【问题描述】:

我正在尝试在 R 上创建图表,但不断收到此错误...

继承错误(映射,“uneval”):找不到对象“EI.TOT”

我已经输入了这个命令:

hist.1 <- ggplot(data, EI.TOT) + theme(legend.position = "none") + geom_histogram(aes(y=..density..), colour="black", fill="white") + labs(x="EI.TOT", y = "Density")

EI.TOT 是我的一个专栏的标题。我已经使用这些值进行了回归,但是当我想创建直方图时,却说找不到该列。

【问题讨论】:

  • 尝试 ..hist.1

标签: r ggplot2 histogram


【解决方案1】:

你的问题是你没有正确指定你的 aes。试试这个代码,让我知道它是否不适用于您的数据。

library(ggplot2)
data <- data.frame(EI.TOT =rnorm(60))

hist.1 <- ggplot(data=data) +
  theme(legend.position = "none") + 
  geom_histogram(aes(EI.TOT),colour="black", fill="white", binwidth = 0.5) +
  labs(x="EI.TOT", y = "Density")


hist.1

更改 bindwidth 以更改绘图中的中断。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-16
    • 1970-01-01
    • 2011-12-02
    • 1970-01-01
    • 1970-01-01
    • 2012-02-04
    • 1970-01-01
    相关资源
    最近更新 更多