【发布时间】:2020-04-01 23:55:47
【问题描述】:
我有一个热图,它绘制了一个包含 3 列和 100 行的数据框。 X 和 Y 轴代表 X 和 Y 坐标。当我创建地图时,它会显示每个位置并且变得不可读。
两个轴的范围都是 0-100。我希望两个轴都只是去 0,10,20,30,40,50,60,70,80,90,100。谁能帮我清理一下?谢谢。
ggplot( data = CombinedDF, mapping = aes( x = factor(allPoints.xLocs), y = factor(allPoints.yLocs) ) ) +
geom_tile( aes( fill = sum_patch ), colour = "white") + labs( x = "X-Coordinate", y = "Y-Coordinate") +
theme_bw() + theme(axis.text.x = element_text(angle = 45, hjust = 1))
Here is the sample of the input dataframe "CombinedDF"
allPoints.xLocs allPoints.yLocs sum_patch
1 74.106128071 62.2365805 13
2 70.786698116 58.8928561 13
3 65.543694422 33.8426416 3
4 8.647094783 50.1071865 2
5 95.822909172 11.3294181 4
6 91.324434988 42.4157078 5
7 96.444815141 68.6108005 13
8 13.105758978 83.1488258 7
9 92.958515161 74.3948395 13
10 76.149455458 98.8090307 4
【问题讨论】:
-
删除“因素”到你的
aes -
请提供您的数据集的可重现示例,以便人们为您提供帮助。请参阅本指南:stackoverflow.com/questions/5963269/…
-
谢谢@dc37。我提供了一个例子。