[R] merger two 3-d scatter plot

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Sep 27 19:16:53 CEST 2011


If you are talking about the scatterplot3d package, and we assume your 
data is in data.frame called "dat":


library("scatterplot3d")
s3d <- scatterplot3d(dat$obs30, dat$Cases, dat$RANK1)
s3d$points3d(dat$obs30, dat$Cases, dat$RANK2, col=2)

Uwe Ligges



On 26.09.2011 22:08, XINLI LI wrote:
>>
>> Dear David and R groups:
>>
>>   I have the data as follows, I want to plot the "Rank1 ~ obs30*Cases" and
>> "Rank2 ~ obs30*Cases" on the same plot as one 3-D scatter plot, how to do
>> that? Any help is highly appreciated.
>> /************************************************/
>
>
> ID obs30 Cases RANK1 RANK2
> 1 0.03175 63 82 81
> 2 0.00000 34 1 34
> 3 0.00000 36 2 41
> 4 0.00000 54 3 26
> 5 0.00000 22 4 42
> 6 0.00746 134 39 32
> 7 0.00000 2 5 53
> 8 0.01190 168 46 31
> 9 0.03012 166 78 86
> 10 0.00775 129 43 37
> 11 0.01290 155 51 43
> 12 0.00459 218 24 6
> 13 0.04348 23 92 73
> 14 0.02198 182 66 71
> 15 0.01546 194 60 62
> 16 0.01370 73 47 40
> 17 0.00424 236 23 2
> 18 0.00735 136 31 19
> 19 0.03030 66 86 85
> 20 0.03030 33 65 58
> 21 0.02273 132 59 59
> 22 0.02439 123 68 68
> 23 0.08333 24 83 78
> 24 0.01266 79 50 45
> 25 0.01024 293 28 4
> 26 0.00926 108 29 14
> 27 0.03750 160 85 95
> 28 0.01290 155 55 55
> 29 0.00935 107 30 20
> 30 0.04598 87 89 94
> 31 0.01087 92 41 36
> 32 0.00000 2 6 50
> 33 0.01695 118 42 23
> 34 0.04918 61 88 92
>
> # my test codes
>
>
> print(scatterplot3d(RANK1 ~ obs30 + Cases, type = "h", angle = plot.angle,
> color = rgb(0,0,0,0.5),
>                pch = 20, cex.symbols=2, col.axis="gray", col.grid="gray"))
>
> #********************************************************
>
> print(scatterplot3d(RANK2 ~ obs30 + Cases, type = "h", angle = plot.angle,
> color = rgb(0,0,0,0.5),
>                pch = 20, cex.symbols=2, col.axis="gray", col.grid="gray"))
>
> On Mon, Sep 26, 2011 at 1:33 PM, David Winsemius<dwinsemius at comcast.net>wrote:
>
>>
>> On Sep 26, 2011, at 3:06 PM, XINLI LI wrote:
>>
>> Dear R groups:
>>>
>>>   I have the data as follows, I want to plot the "Rank1 ~ obs30*Cases" and
>>> "Rank2 ~ obs30*Cases" on the same plot as one 3-D scatter plot, how to do
>>> that? Any help is highly appreciated.
>>>
>>
>> There is no "Method" in that data and your code throws an error.
>>
>>>
>>> ID obs30 Cases RANK1 RANK2
>>> 1 0.03175 63 82 81
>>> 2 0.00000 34 1 34
>>> 3 0.00000 36 2 41
>>> 4 0.00000 54 3 26
>>> 5 0.00000 22 4 42
>>> 6 0.00746 134 39 32
>>> 7 0.00000 2 5 53
>>> 8 0.01190 168 46 31
>>> 9 0.03012 166 78 86
>>> 10 0.00775 129 43 37
>>> 11 0.01290 155 51 43
>>> 12 0.00459 218 24 6
>>> 13 0.04348 23 92 73
>>> 14 0.02198 182 66 71
>>> 15 0.01546 194 60 62
>>> 16 0.01370 73 47 40
>>> 17 0.00424 236 23 2
>>> 18 0.00735 136 31 19
>>> 19 0.03030 66 86 85
>>> 20 0.03030 33 65 58
>>> 21 0.02273 132 59 59
>>> 22 0.02439 123 68 68
>>> 23 0.08333 24 83 78
>>> 24 0.01266 79 50 45
>>> 25 0.01024 293 28 4
>>> 26 0.00926 108 29 14
>>> 27 0.03750 160 85 95
>>> 28 0.01290 155 55 55
>>> 29 0.00935 107 30 20
>>> 30 0.04598 87 89 94
>>> 31 0.01087 92 41 36
>>> 32 0.00000 2 6 50
>>> 33 0.01695 118 42 23
>>> 34 0.04918 61 88 92
>>>
>>> I used the following code for one plot:
>>> print(cloud(RANK1 ~ Cases * obs30, data = xll, groups = Method, screen =
>>> list(z=20, x= -70),
>>>     perspective = FALSE, key = list(title = "Ranking HOSP", x = 100, y =
>>> 100,  corner= c(0, 0), border = TRUE,
>>>     points = Rows(trellis.par.get("**superpose.symbol"), 1:2
>>>     ))))
>>> #
>>> ##############################**##############################**
>>> ##############################**####################
>>> print(cloud(RANK2 ~ Cases * obs30, data = xll, groups = Method, screen =
>>> list(z=20, x= -70),
>>>     perspective = FALSE, key = list(title = "Ranking HOSP", x = 100, y =
>>> 100,  corner= c(0, 0), border = TRUE,
>>>     points = Rows(trellis.par.get("**superpose.symbol"), 1:2
>>>     ))))
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> ______________________________**________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>>> PLEASE do read the posting guide http://www.R-project.org/**
>>> posting-guide.html<http://www.r-project.org/posting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>
> 	[[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