Quantcast

drawing a specific "plane" with scatterplot3d

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

drawing a specific "plane" with scatterplot3d

Andras Farkas
Dear All,
 
using the example from the package scatterplot3d I created a 3d plot as follows:
 
x <-rnorm(500,50,2)
y <-rnorm(500,5,1)
z <-rnorm(500,6,1)
scatterplot3d(x, y, z, highlight.3d=TRUE, col.axis="blue",col.grid="lightblue", main="scatterplot3d - 1", pch=20)
 
I would like to ask if anyone could help me with the following:
 
1. I would like to draw  a plane across the plot that is paralell to the bottom of the plot and is in the heights of the value 6 on the axis "z", and goes across the plot
2. Is there a way to color all plotted values with the "z" variate less than the value of 6 one color, and all the rest another color?
 
I would greatly apreciate the help on this,
 
Sincerely,
 
Andras
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: drawing a specific "plane" with scatterplot3d

Duncan Murdoch-2
On 12-07-31 2:54 PM, Andras Farkas wrote:

> Dear All,
>
> using the example from the package scatterplot3d I created a 3d plot as follows:
>
> x <-rnorm(500,50,2)
> y <-rnorm(500,5,1)
> z <-rnorm(500,6,1)
> scatterplot3d(x, y, z, highlight.3d=TRUE, col.axis="blue",col.grid="lightblue", main="scatterplot3d - 1", pch=20)
>
> I would like to ask if anyone could help me with the following:
>
> 1. I would like to draw  a plane across the plot that is paralell to the bottom of the plot and is in the heights of the value 6 on the axis "z", and goes across the plot

This is hard to do in scatterplot3d, because some points should be
hidden and others shown in front of such a plane, but scatterplot3d has
no way to do that.  You could do it using the rgl package; the commands
there would be something like this (without the coloring you did in
scatterplot3d):

plot3d(x,y,z)
planes3d(0,0,-1,6,col="red")

> 2. Is there a way to color all plotted values with the "z" variate less than the value of 6 one color, and all the rest another color?

In rgl you would do it using

plot3d(x,y,z, col=ifelse(z < 6, "blue", "red"))

I think the same sort of thing works in scatterplot3d, but the arg name
is color, not col.

Duncan Murdoch


>
> I would greatly apreciate the help on this,
>
> Sincerely,
>
> Andras
> [[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: drawing a specific "plane" with scatterplot3d

Uwe Ligges-3


On 31.07.2012 21:14, Duncan Murdoch wrote:

> On 12-07-31 2:54 PM, Andras Farkas wrote:
>> Dear All,
>>
>> using the example from the package scatterplot3d I created a 3d plot
>> as follows:
>>
>> x <-rnorm(500,50,2)
>> y <-rnorm(500,5,1)
>> z <-rnorm(500,6,1)
>> scatterplot3d(x, y, z, highlight.3d=TRUE,
>> col.axis="blue",col.grid="lightblue", main="scatterplot3d - 1", pch=20)
>>
>> I would like to ask if anyone could help me with the following:
>>
>> 1. I would like to draw  a plane across the plot that is paralell to
>> the bottom of the plot and is in the heights of the value 6 on the
>> axis "z", and goes across the plot
>
> This is hard to do in scatterplot3d, because some points should be
> hidden and others shown in front of such a plane, but scatterplot3d has
> no way to do that.

No, but the human brain may help to make it not too hard a task:

s3d <- scatterplot3d(x[z<6], y[z<6], z[z<6], zlim=range(z),
     color="darkgrey", col.axis="blue",col.grid="lightblue",
     main="scatterplot3d - 1", pch=20)
s3d$plane3d(6, 0, 0)
s3d$points3d(x[z>=6], y[z>=6], z[z>=6], pch=20)

Best,
Uwe ligges




You could do it using the rgl package; the commands

> there would be something like this (without the coloring you did in
> scatterplot3d):
>
> plot3d(x,y,z)
> planes3d(0,0,-1,6,col="red")
>
>> 2. Is there a way to color all plotted values with the "z" variate
>> less than the value of 6 one color, and all the rest another color?
>
> In rgl you would do it using
>
> plot3d(x,y,z, col=ifelse(z < 6, "blue", "red"))
>
> I think the same sort of thing works in scatterplot3d, but the arg name
> is color, not col.
>
> Duncan Murdoch
>
>
>>
>> I would greatly apreciate the help on this,
>>
>> Sincerely,
>>
>> Andras
>>     [[alternative HTML version deleted]]
>>
>>
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: drawing a specific "plane" with scatterplot3d

Duncan Murdoch-2
On 12-08-01 8:42 AM, Uwe Ligges wrote:

>
>
> On 31.07.2012 21:14, Duncan Murdoch wrote:
>> On 12-07-31 2:54 PM, Andras Farkas wrote:
>>> Dear All,
>>>
>>> using the example from the package scatterplot3d I created a 3d plot
>>> as follows:
>>>
>>> x <-rnorm(500,50,2)
>>> y <-rnorm(500,5,1)
>>> z <-rnorm(500,6,1)
>>> scatterplot3d(x, y, z, highlight.3d=TRUE,
>>> col.axis="blue",col.grid="lightblue", main="scatterplot3d - 1", pch=20)
>>>
>>> I would like to ask if anyone could help me with the following:
>>>
>>> 1. I would like to draw  a plane across the plot that is paralell to
>>> the bottom of the plot and is in the heights of the value 6 on the
>>> axis "z", and goes across the plot
>>
>> This is hard to do in scatterplot3d, because some points should be
>> hidden and others shown in front of such a plane, but scatterplot3d has
>> no way to do that.
>
> No, but the human brain may help to make it not too hard a task:
>
> s3d <- scatterplot3d(x[z<6], y[z<6], z[z<6], zlim=range(z),
>       color="darkgrey", col.axis="blue",col.grid="lightblue",
>       main="scatterplot3d - 1", pch=20)
> s3d$plane3d(6, 0, 0)
> s3d$points3d(x[z>=6], y[z>=6], z[z>=6], pch=20)

Nice solution.  Generally speaking scatterplot3d graphs reproduce better
than rgl graphs (since they use the regular graphics devices), so it's
worthwhile using them when you can.

Duncan Murdoch

>
> Best,
> Uwe ligges
>
>
>
>
> You could do it using the rgl package; the commands
>> there would be something like this (without the coloring you did in
>> scatterplot3d):
>>
>> plot3d(x,y,z)
>> planes3d(0,0,-1,6,col="red")
>>
>>> 2. Is there a way to color all plotted values with the "z" variate
>>> less than the value of 6 one color, and all the rest another color?
>>
>> In rgl you would do it using
>>
>> plot3d(x,y,z, col=ifelse(z < 6, "blue", "red"))
>>
>> I think the same sort of thing works in scatterplot3d, but the arg name
>> is color, not col.
>>
>> Duncan Murdoch
>>
>>
>>>
>>> I would greatly apreciate the help on this,
>>>
>>> Sincerely,
>>>
>>> Andras
>>>      [[alternative HTML version deleted]]
>>>
>>>
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>>
>>
>> ______________________________________________
>> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: drawing a specific "plane" with scatterplot3d

Uwe Ligges-3


On 01.08.2012 15:28, Duncan Murdoch wrote:

> On 12-08-01 8:42 AM, Uwe Ligges wrote:
>>
>>
>> On 31.07.2012 21:14, Duncan Murdoch wrote:
>>> On 12-07-31 2:54 PM, Andras Farkas wrote:
>>>> Dear All,
>>>>
>>>> using the example from the package scatterplot3d I created a 3d plot
>>>> as follows:
>>>>
>>>> x <-rnorm(500,50,2)
>>>> y <-rnorm(500,5,1)
>>>> z <-rnorm(500,6,1)
>>>> scatterplot3d(x, y, z, highlight.3d=TRUE,
>>>> col.axis="blue",col.grid="lightblue", main="scatterplot3d - 1", pch=20)
>>>>
>>>> I would like to ask if anyone could help me with the following:
>>>>
>>>> 1. I would like to draw  a plane across the plot that is paralell to
>>>> the bottom of the plot and is in the heights of the value 6 on the
>>>> axis "z", and goes across the plot
>>>
>>> This is hard to do in scatterplot3d, because some points should be
>>> hidden and others shown in front of such a plane, but scatterplot3d has
>>> no way to do that.
>>
>> No, but the human brain may help to make it not too hard a task:
>>
>> s3d <- scatterplot3d(x[z<6], y[z<6], z[z<6], zlim=range(z),
>>       color="darkgrey", col.axis="blue",col.grid="lightblue",
>>       main="scatterplot3d - 1", pch=20)
>> s3d$plane3d(6, 0, 0)
>> s3d$points3d(x[z>=6], y[z>=6], z[z>=6], pch=20)
>
> Nice solution.  Generally speaking scatterplot3d graphs reproduce better
> than rgl graphs (since they use the regular graphics devices), so it's
> worthwhile using them when you can.

rgl is much better for data analysis, actually: quickly turn the stuff
around and see what is going on. I'd prefer scatterplot3d only if static
2D representation is relevant.

Uwe




>
> Duncan Murdoch
>
>>
>> Best,
>> Uwe ligges
>>
>>
>>
>>
>> You could do it using the rgl package; the commands
>>> there would be something like this (without the coloring you did in
>>> scatterplot3d):
>>>
>>> plot3d(x,y,z)
>>> planes3d(0,0,-1,6,col="red")
>>>
>>>> 2. Is there a way to color all plotted values with the "z" variate
>>>> less than the value of 6 one color, and all the rest another color?
>>>
>>> In rgl you would do it using
>>>
>>> plot3d(x,y,z, col=ifelse(z < 6, "blue", "red"))
>>>
>>> I think the same sort of thing works in scatterplot3d, but the arg name
>>> is color, not col.
>>>
>>> Duncan Murdoch
>>>
>>>
>>>>
>>>> I would greatly apreciate the help on this,
>>>>
>>>> Sincerely,
>>>>
>>>> Andras
>>>>      [[alternative HTML version deleted]]
>>>>
>>>>
>>>>
>>>> ______________________________________________
>>>> [hidden email] 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.
>>>>
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

bpplot question

Andras Farkas
Dear All,
 
wondering if I could get some help on the following using a box-percentile plotting in Hmisc:
 
1. how could I put limits on the y axis? the following does NOT seem to work:
 
bpplot(b,c,d,e,f,g,h, ylim=c(0,2500))
 
2. I would like to color in each box plot from b to h the line representing the median with the color of red, the interquantile range with the color of yellow, and the areas outside of the interquantile ranges with the color of green.
 
I am open to alternative solutions, also
 
All of your help is greatly apreciated, as allways,
 
Sincerely,
 
Andras 
        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Loading...