|
[Date Index]
[Thread Index]
[Author Index]
Re: Surface graphics (Plot4D) coloring question
- To: mathgroup at smc.vnet.net
- Subject: [mg31858] Re: Surface graphics (Plot4D) coloring question
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Fri, 7 Dec 2001 05:56:55 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Mak Diamond wrote:
I have reason to calculate the volume over a (non-centred) circular area of
a bivariate normal distribution (BND). By non-centred, I simply mean that
the centre of the disc does not correspond with the means of the two normal
distributions. ....... I would like to construct a surface graphic (probably
with Plot3D or ListPlot3D) of the BND, but then I would like to color a part
of the suface (the part being defined by the underlying disc) in a
distinctive colour (I should probably say "distinctive colours" since
keeping some part of the Lighting as well as grid would be nice). Has anyone
done something like this before? I searched the archive but found no similar
question.
-----------------------
That can be done if you download the package posted at
http://www.mathsource.com/Content/Enhancements/Graphics/3D/0211-116
and I think you need to put the package in a folder included in the list you
get after evaluating ($Path). The function in the package doesn't have a
DisplayFunction option. In fact it only has a few options in all, and I
don't think it's well designed. However it does make nice looking results!
First load the package.
In[1]:=
Needs["Graphics`phasePlot3D`", "phasePlot3D.m"]
-------------
Here I define a bivariate normal PDF.
In[2]:=
NormalPDF[x1_, x2_]:=E^((-(x1*((4*x1)/3 - (2*x2)/3)) -
x2*((-2*x1)/3 + (4*x2)/3))/2)/(Sqrt[3]*Pi);
--------------
Suppose you want to show the portion above a circle with radius 0.9 centered
at
{x1, x2}={1, -1}. In that case the code below will do what you want.
In[3]:=
InsideCircleQ[ {x1_, x2_} ]:=
Which[Sqrt[{x1-1, x2+1}.{x1-1, x2+1}]<0.9, 1, True, 2];
Yes[{x1_, x2_}]:=NormalPDF[x1, x2]+0.002;
No[{x1_, x2_}]:=-0.1;
In[6]:=
gr1=Graphics3D[ Plot3D[ NormalPDF[ x1, x2 ], {x1, -3, 3}, {x2, -3, 3},
PlotRange->{0, 0.184}, PlotPoints->30, DisplayFunction->Identity ]
];
gr2=phasePlot3D[InsideCircleQ, {Yes, No}, {x1, -3, 3}, {x2, -3, 3},
PlotRange->{0, 0.184}, PlotPoints->30 ];
gr2=Insert[gr2, SurfaceColor[RGBColor[1.0,0.8,0.8]], {1, 1} ];
Show[gr1, gr2, DisplayFunction->$DisplayFunction];
(* Graphics not shown *)
If you have questions I can explain how the code above works.
------------------
Regards,
Ted Ersek
Check Mathematica Tips, Tricks at
http://www.verbeia.com/mathematica/tips/Tricks.html
Prev by Date:
Re: scope all wrong? in Mathematica 4.1
Next by Date:
Re: scope all wrong? in Mathematica 4.1
Previous by thread:
Penrose Seasons Greetings
Next by thread:
Re: Re: No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000 SP2
|