如何在R的3d散点图中获得正确的ticklabs? [英] How to get correct ticklabs in a 3d-scatterplot in R?
本文介绍了如何在R的3d散点图中获得正确的ticklabs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请看这个例子.查看 y
轴.那里的数据只有两个级别:1
和2
.但在图中,该轴上绘制了 6 个刻度线.我怎么能解决这个问题.x
轴也有同样的问题.
Please see this example. Look at y
axis. The data there has only two levels: 1
and 2
. But in the plot 6 tickmarks drawn on that axis. How could I fix that. The x
axis has the same problem.
数据
extra group ID
1 0.7 1 1
2 -1.6 1 2
3 -0.2 1 3
4 -1.2 1 4
5 -0.1 1 5
6 3.4 1 6
7 3.7 1 7
8 0.8 1 8
9 0.0 1 9
10 2.0 1 10
11 1.9 2 1
12 0.8 2 2
13 1.1 2 3
14 0.1 2 4
15 -0.1 2 5
16 4.4 2 6
17 5.5 2 7
18 1.6 2 8
19 4.6 2 9
20 3.4 2 10
脚本
require('mise')
require('scatterplot3d')
mise() # clear the workspace
# example data
print(sleep)
# plot it
scatterplot3d(x=sleep$ID,
x.ticklabs=levels(sleep$ID),
y=sleep$group,
y.ticklabs=levels(sleep$group),
z=sleep$extra)
结果
推荐答案
这个怎么样:
scatterplot3d(x=sleep$ID, y=sleep$extra, z=sleep$group, lab.z = c(1, 2))
这篇关于如何在R的3d散点图中获得正确的ticklabs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文