[R] scatterplot3d; scaling point symbols to depth of graph

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Oct 28 20:57:08 CEST 2010


It's a bug (since I did not expect people to change the size of the 
symbols vectorized).
Will provide a fix tomorrow.

Uwe




On 28.10.2010 11:28, John Coulthard wrote:
>
> Hi
>
> I'm trying to scale the point symbols on a 3d plot so that the ones at the front are larger than the ones at the back.  I'm trying to give the image some perspective.
>
> Given this code...
>
> library(scatterplot3d)
> data=array(c(0,5,9), c(3,3))
> scatterplot3d(data, pch=19, cex.symbols=10-data[,2], color=c("red","blue","black"));
>> data
>
>
>       [,1] [,2] [,3]
>
>
> [1,]    0    0    0
>
>
> [2,]    5    5    5
>
>
> [3,]    9    9    9
>
>
>
> which gives a vector for  cex.symbols as
>> 10-data[,2]
>
> [1] 10  5  1
>
>
>   I would expect the largest point to be the red one at the origin but
> the image I get has the black symbol at co-ords 9,9,9 as the largest and red at 0,0,0 the smallest.
>
> Then if I do...
>> data=array(c(0,9,5), c(3,3))
>> data
>       [,1] [,2] [,3]
> [1,]    0    0    0
> [2,]    9    9    9
> [3,]    5    5    5
>> scatterplot3d(data, pch=19, cex.symbols=10-data[,2], color=c("red","blue","black"));
>> 10-data[,2]
> [1] 10  1  5
>
> I'd expect the position and size of the points to be the same but the colour of blue and black to be exchanged.  But the size of the points also changes such that the red point at 0,0,0 is the medium size and the black at 5,5,5 is the smallest.
>
> So is it possible to get the points described by each row in data to be scaled by the values in data[,2]?
>
> Many thanks
>
> John
>
>
>
>> sessionInfo()
> R version 2.11.1 (2010-05-31)
> i386-redhat-linux-gnu
>
> locale:
>   [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C
>   [3] LC_TIME=en_US.utf8        LC_COLLATE=en_US.utf8
>   [5] LC_MONETARY=C             LC_MESSAGES=en_US.utf8
>   [7] LC_PAPER=en_US.utf8       LC_NAME=C
>   [9] LC_ADDRESS=C              LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] scatterplot3d_0.3-30
>
> loaded via a namespace (and not attached):
> [1] tools_2.11.1
>
>   		 	   		
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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