r - 如何使用 ggplot2 缩放图形
问题描述
ggplot(data=response, aes(x=beak_size, fill=generation))
到目前为止,这是我的代码,我不断得到一个几乎不可读的图形,当我尝试使用基本 RI 制作直方图时,以下代码不断出现此错误:
hist(response$beak_size, col="lightblue",
main="Graph",
xlab="Beak Size", ylab="Count")
Error in hist.default(response$beak_size, col = "lightblue", main = "Graph", :
'x' must be numeric
解决方案
使用hist()
:
hist(as.numeric(response$beak_size), col="lightblue",
main="Graph",
xlab="Beak Size", ylab="Count")
如果您的可变测量尺度不是定量的,则应使用barplot()
.
推荐阅读
- android - 后台 AsyncTask 需要很长时间才能完成
- laravel - 多个警卫使用一个登录页面是否安全?
- javascript - 带有相对容器或固定面板的 Jquery 可拖放 Z-Index
- python - 在变量中的python字符串上触发f-string解析
- r - 基于类型的自定义“ggplot2”扩展中的子集数据
- hive - 将日期值动态分配给配置单元查询
- python - 在新对象实例之间共享变量
- angular - 如何在 Angular 7 中使用 ChangeDetection(视图未更新)?
- angular - Angular RXJS 结构化 observables
- amazon-web-services - Redshift 中的 Unload 命令语法错误