[R] 3-D-Plot

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Apr 19 20:59:17 CEST 2008


Edwin,

the problem is that the underlying R code treats the "lab" argument as 
something that should be approximate in some way.

In your case, you can say, e.g.:

par(lwd=3)
scatterplot3d(.....
               lab= c(5,hostLength*2),
               .....)

Best wishes;
uwe



Edwin Sendjaja wrote:
> Hi Uwe,
> 
> In your example, you have a numeric value in dataset. 
> 
> But my problem is that I have character value, like:uni Dortmund, uni Berlin, 
> etc.
> 
> 
> --------------------------------------------
> For example:
> 
>   Name Student Ranking
> 
> 1 Uni Dortmund 100000 1
> 2. Uni Berlin 20000 3
> ...etc
> 
> ---------------------------------------
> 
> I want that "Name" coloumn as y-axis.
> 
> 
> 
> ########
> 
> For detail I send you as attachment my data. In that graphic you can see that 
> I want the Host-name as y-axis. But unfortunately it doesn't plot correctly 
> at the right place. Besides that, the length of y-label doesn't match like 
> what I've configured. It is strange, because I have actually hostLength= 10. 
> but in graphic: 
> peeramidion.irisa.fr-Messung-19.04.08_14.57-Timeout50-Transmission500-Europa-1-grafik-RTT_bigger_40000_3D.pdf
> 
> Unfortunately, it shows only 9 Hosts.
> -----------------------------------------------------------------------------------------------------------
> 
> The Code:
> 
> 
> data <- 
> read.table("peeramidion.irisa.fr-Messung-TEST-50-500-Europa-1-registrar.data")
> mapping <- read.table("Messung-TEST-50-500-Europa-1-mappingfile-PE.data")
> mergeXY<- merge(data,mapping, by.x="PE_ID", by.y="ID")
> 
> mergeXY <- subset(mergeXY, (mergeXY$Ereignis == "EndpointKeepAlive") & 
> (mergeXY$Zusatz > 40000))
> 
> 
> xSet <- mergeXY$RelTime
> xTitle <- "Zeit [s]"
> 
> 
> ySet <- mergeXY$Host
> yTitle <- "PE-Hosts"
> 
> zSet <- mergeXY$Zusatz / 1000.0
> zTitle <- "Round Trip Time [ms]"
> 
> 
> hostList <- levels(factor(ySet))
> hostLength <- length(hostList)
> 
> pdf("RESULT.pdf", width=17, height=25, onefile=TRUE, family="Helvetica", 
> pointsize=22)
> 
> par(lwd=3)
> scatterplot3d(xSet, ySet, zSet, 
>               xlab=xTitle, ylab=yTitle, zlab=zTitle,
>               axis=TRUE, tick.marks=TRUE, label.tick.marks=TRUE,
>               grid=TRUE, box=TRUE, highlight.3d=TRUE,
>                
>               main="Round Trip Time - EndpointKeepAlive",
>               sub="Pool Registrar: peeramidion.irisa.fr",  
>               color=par("col"), pch=16, type="h",
>               scale.y=1, angle=40, 
>               mar=c(5,5,5,5), y.margin.add=7,
>               font.axis=2, font.lab=2,
>               lty.grid=2,
>      
>               y.ticklabs=hostList, 
>               lab= c(5,hostLength),       
>               lab.z=5)         
> 
> dev.off()
> 
> #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
> 
> 
> I hope you can help me to solve this problem.
> 
> 
> 
> 
> Kind regards,
> 
> 
> 
> 
> Edwin
> 
> Am Freitag, 18. April 2008 13:58:33 schrieb Uwe Ligges:
>> Edwin Sendjaja wrote:
>>> Hi Uwe,
>>>
>>> I decided to use scatterplot3d, because it looks better.
>>> I have some questions:
>>>
>>> Is it possible to get 1 axis( for example: z-axis) not as numeric, but as
>>> character.
>>>
>>> Because I have date set like this:
>>>
>>> x=relative Time: 0,3 ms; 0,5ms, etc
>>> y=Delay:10 ms, 20 ms, etc
>>> z= Host: cnn.com, heise.de,etc
>> See ?scatterplot3d. You can use arguments x.ticklabs, y.ticklabs,
>> z.ticklabs in order top specify character strings.
>>
>>> If no, can you tell me little how to modify the code to get this. Thank
>>> you.
>>>
>>> another question:
>>>
>>> How can I change the width line of the axis (x,y,z). The default line is
>>> for me too thin.
>> par(lwd=2) or more, for example.
>>
>>
>> First example from ?scatterplot3d  but with some other labels on x axis
>> and thick lines:
>>
>>    z <- seq(-10, 10, 0.01)
>>    x <- cos(z)
>>    y <- sin(z)
>>    par(lwd=3)
>>    scatterplot3d(x, y, z, highlight.3d=TRUE, col.axis="blue",
>>        col.grid="lightblue", main="scatterplot3d - 1", pch=20,
>>        x.ticklabs=paste(seq(0.3, 1.1, by=0.2), "ms"),
>>        xlab="relative Time")
>>
>> Best wishes,
>> Uwe
>>
>>> Thank you in advance,
>>>
>>>
>>> Edwin Sendjaja
>>>
>>> Am Donnerstag, 17. April 2008 14:43:39 schrieb Uwe Ligges:
>>>> Edwin Sendjaja wrote:
>>>>> Hi Uwe,
>>>>>
>>>>> Thanks for your answer.
>>>>>
>>>>> What is the different between rgl and scatterplot3d? I dont need a
>>>>> graphik like vulcano. I just need 3D-"dot"-plot.
>>>> Sure, rgl can do it as well.
>>>> Difference is that scatterplot3d is based on R's standard devices while
>>>> rgl is based on an OpenGL device. Hence rgl is much more flexible and
>>>> can rotate things and easily draws nice transparent forms, but
>>>> scatterplot3d is nice for printing to 2D in different formats at the
>>>> end.
>>>>
>>>> Uwe
>>>>
>>>>> Am Donnerstag, 17. April 2008 09:03:17 schrieb Uwe Ligges:
>>>>>> Edwin Sendjaja wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I've got some problems. I hope someone can help me.
>>>>>>>
>>>>>>> First question:
>>>>>>> I am trying to get grid on scatterplot3d (from scatterplot3d
>>>>>>> package). It seems that scatterplot3d draw on grip on X and Z side.
>>>>>>> Is it possible to get Grid on the whole Box?
>>>>>> At least there is no build in function to do it.
>>>>>>
>>>>>>> Second question:
>>>>>>> Is it possible to use the standard package drawing 3d-plot(without
>>>>>>> scatterplot3d) ?because now I have already 2d-plot. I just want to
>>>>>>> add the z-axis.
>>>>>> See, for example, ?cloud in package "lattice", ?plot3d in package
>>>>>> "rgl",
>>>>>>
>>>>>>> Third question:
>>>>>>> What is the best 3d-plot? it seems that scatterplot3 doesn't support
>>>>>>> anything( like turning the box vertically. I think, angle parameter
>>>>>>> just turn the box horisontally. I might wrong with this.
>>>>>> You are right.
>>>>>>
>>>>>> Best wishes,
>>>>>> Uwe
>>>>>>
>>>>>>> Thank a lot in advance
>>>>>>>
>>>>>>> Edwin
>>>>>>>
>>>>>>> ______________________________________________
>>>>>>> R-help at r-project.org mailing list
>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>>> PLEASE do read the posting guide
>>>>>>> http://www.R-project.org/posting-guide.html and provide commented,
>>>>>>> minimal, self-contained, reproducible code.
>>>>>> ______________________________________________
>>>>>> R-help at r-project.org mailing list
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>> PLEASE do read the posting guide
>>>>>> http://www.R-project.org/posting-guide.html and provide commented,
>>>>>> minimal, self-contained, reproducible code.
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html and provide commented,
>>>>> minimal, self-contained, reproducible code.
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html and provide commented,
>>>> minimal, self-contained, reproducible code.



More information about the R-help mailing list