简体   繁体   中英

R scatterplot3d turn x axis text 45°

I have something like this, and want to turn xlabels 45 degrees (it is going to be rather long text):

a<-c(1:10)
b<-c(1:10)
c<-c(1:10)
  scatterplot3d(a,b,c,
                main="3-D Scatterplot",color="blue", pch=19,
                type="h", lty.hplot=2, box=F,
            scale.y=.5, 
            lty.grid=1,
            lab=c(9,5,1),
            xlab="",
            ylab="",
            zlab="")

You could do the following:

library(scatterplot3d)
a<-c(1:10)
b<-c(1:10)
c<-c(1:10)
#remove x labels using x.ticklabs = ''
scatterplot3d(a,b,c,
              main="3-D Scatterplot",color="blue", pch=19,
              type="h", lty.hplot=2, box=F,
              scale.y=.5, 
              lty.grid=1,
              lab=c(9,5,1),
              xlab="",
              ylab="",
              zlab="", x.ticklabs='')
#add the labels using the text function. srt specifies the angle.
text(x=b, y=1, pos=1, labels=b, srt=45, adj=1, xpd=TRUE, offset=0.5)

And it works!

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM