R: Positioning labels and axes with rgl.plot3d

I am trying to create a 3D scatter plot using rgl.plot3d. However, the default positioning of labels and axes is not satisfactory. For example, the y-axis label is on the opposite side, while I want it to be on the near side. The x-axis keys are located at the very top. I went to them to place them on a close bottom. I looked at ?par3d

but couldn't find anything that could help me. Can this be done in rgl? Code and data are shown below. Thank.

Code

d <- read.table(file='myfile.dat', header=F)
plot3d(
    d,
    xlim=c(0,20),
    ylim=c(0,20),
    zlim=c(0,10000),
    box=F,
    type='p',
    size=5,
    col=d[,1]
)
mtext3d(text='Test', edge='y+-', line=2)
axes3d(
    edges=c('x--', 'y+-', 'z--'),
    labels=T
)
lines3d(
    d,
    lwd=2,
    col=d[,1]
)
grid3d(side=c('x', 'y+', 'z'))

      

Data

11    2    2
NA    NA    NA
10    2    2
NA    NA    NA
13    2    1
NA    NA    NA
15    2    1
NA    NA    NA
5    2    11
5    3    10
5    4    16
5    5    34
5    6    102
5    7    294
5    8    682
5    9    1439
5    10    2646
5    11    3615
5    12    2844
5    13    1394
NA    NA    NA
4    2    10
4    3    4
4    4    4
4    5    10
4    6    38
4    7    132
4    8    396
4    9    976
4    10    2121
4    11    4085
4    12    6261
4    13    6459
4    14    4238
4    15    1394
NA    NA    NA
7    2    3
NA    NA    NA
6    2    2
NA    NA    NA
9    2    8
9    3    6
9    4    4
9    5    5
NA    NA    NA
8    2    4
8    3    10
8    4    22
8    5    52
8    6    126
8    7    264
8    8    478
8    9    729
8    10    943
8    11    754
8    12    382
NA    NA    NA

      

+3


source to share


1 answer


You need to see ?axis3d

where the "edge" parameter is used. If you want the x-axis labels to be on the front and on the y-axis on the near and bottom side, you first plotted with ..., axes=FALSE,

and with this issue unchanged on the console:

axes3d( edges=c("x--", "y--", "z") )

      



I haven't figured out yet if it is possible to delete the existing axis in the rgl plot.

+3


source







All Articles