[英]ggplot2, qplot, warnings and error about stat_count()
我在使用ggplot2和qplot函數時遇到了一個錯誤(請參閱下面的警告和錯誤),並且我不知道如何進行更改以使其正常工作。 我查看了與該問題有關的過往帖子,但仍然無法更正代碼。
有人可以給我一些建議嗎?
> library(ggplot2)
Warning message: package 'ggplot2' was built under R version 3.2.5
> dodge <- position_dodge(width = .9)
> plot <- qplot(happening, target.looking_M, data=d.c2.subjects, stat="identity",
+ geom="bar", position=dodge,
+ ylab="Proportion of looks", xlab="happening",
+ fill=happening, colour=happening,
+ main="Proportion target looking by condition and testing phase for each single subject")
警告信息:
1: `stat` is deprecated 2: `position` is deprecated
> plot <- plot + facet_grid(type ~ subjectname)
> plot
Error: stat_count() must not be used with ay aesthetic.
如警告qplot
在qplot
已棄用了以這種方式使用stat
。 作為一般建議,我將避免使用qplot
並學習如何使用完整的ggplot
語法,因為這將為您提供更多功能。
為了使此工作有效,您可以改用geom = "col"
。 geom_col
是一個新的geom
,其行為類似於geom_bar(stat = "identity")
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.