R scatterplot3d将x轴文本旋转45°

时间:2015-05-24 19:31:05

标签: r text 3d axis scatter-plot

我有类似的东西,想要将x标签转45度(这将是相当长的文字):

if (@$_POST['client_service_info'] && @$_POST['client_service']) {

    $client_service_info = filter_input(INPUT_POST, 'client_service_info', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
    $client_service = filter_input(INPUT_POST, 'client_service', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
    print 'acb: ' . $client_service[10] . '<br>agasegase: ' . $client_service_info[3];
    if ($client_info && $client_service_info) {
        $msg = $client->addServices($client_service_info, $client_service);
    }
}

1 个答案:

答案 0 :(得分:0)

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!

enter image description here