簡體   English   中英

使用 ggplot2 stat_ecdf 在 R 中創建經驗分布函數

[英]Creating empirical distribution function in R using ggplot2 stat_ecdf

我正在嘗試為經驗分布函數stat_ecdf制作 ggplot 圖,但出現以下錯誤。 有關如何解決此問題的任何幫助? 這里d是一個double列表。

library(ggplot2)
 >> d
 [1] 9.126560 8.837303 6.942810 9.515659 7.614937 9.190298 6.866715 6.322031
 [9] 8.846318 7.181234 9.104691 7.187005 7.371961 7.180689 9.117338 9.174383
[17] 7.209469 9.030088 9.519537 8.987137 7.044774 7.566912 6.845430 9.370125
 >> typeof(d)
[1] "double"
 >> ggplot(data.frame(d), aes(expression)) + stat_ecdf(geom = "point")
Don't know how to automatically pick scale for object of type function. Defaulting to continuous.
Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows: 0, 24

aes需要包含x列。

ggplot(data.frame(x = d), aes(x)) + stat_ecdf(geom = "point")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM