r - ggplot 在 scale_x_discrete 中的中断问题
问题描述
我对 R 很陌生,我在使用 ggplot2 时遇到了问题。
当我第一次尝试在我的数据集中绘制一些点时,我得到了一个带有太多标签的 x 和 y 轴,如下所示:
但是当我尝试使用 scale_x_discrete 时,它不会显示我指定的所有标签。
这是我使用的代码:
ggplot(schooldata, aes(Economic.Need.Index, Average.Math.Proficiency))
+ geom_point()
+ scale_x_discrete(name = "Economic Need Index", breaks = c("0", "0.2", "0.4", "0.6", "0.8", "1"), labels = c("0", "0.2", "0.4", "0.6", "0.8", "1"))
+ scale_y_discrete(name = "Average Math Proficiency", breaks = c("1", "2", "3", "4"), labels = c("1", "2", "3", "4"))
这是我的情节:
我知道这可能有一个非常简单的解决方法,我只是非常缺乏经验,我不知道还有什么可以尝试的。任何帮助将不胜感激,谢谢!
解决方案
推荐阅读
- python - Python json.dumps() 将我的所有数据输出到一行,但我希望每个条目都有一个新行
- javascript - 从 API 获取 YouTube 视频能够通过按钮 Onclick 显示,需要显示在页面上而不是通过按钮点击直接在我的页面上
- itext - 波斯语的 PDF IText-7 布局支持?
- ar.js - AR.JS - 与条形码标记不一致的结果
- python - 如何将基于 html 组件的表转换为 dash Datatable
- docker - 如何使用 Docker 桌面停止 Docker(和 Kubernetes)?
- c# - Dot NET core 3.1 使用 MapControllerRoute 将参数传递给操作
- android - 如何使用范围存储更新 Android 11 中的媒体存储?
- excel - 如何获取活动 NamedSheetView 类的名称属性?
- c# - 无法通过客户端凭据提供程序流在通道中发送消息 - Microsoft Graph API