MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ListDensityPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36101] Re: ListDensityPlot
  • From: hartmut.wolf at t-systems.com (Hartmut Wolf)
  • Date: Wed, 21 Aug 2002 05:52:11 -0400 (EDT)
  • References: <ajd89c$eqi$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Muhammad Sabieh Anwar <sabieh at khwarzimic.org> wrote in message news:<ajd89c$eqi$1 at smc.vnet.net>...
> Hello
> 
> How do I interpret the shading of the ListDensityPlot function?
> 
> If I use something like:
> 
> ListDensityPlot[Table[Sin[x]^2+Tan[y],{x,0,2*Pi},{y,0,2*Pi}]]
> 
> 1. How can I interpret the shading with the z height of the function?
> Such an interpretation is easier if I use somthing like Plot3D which
> also labels the z (height) axis.
> 
> 2. What if in my plot, i want to label demarcate my axes in multiples of
> Pi/2, such as 0, Pi/2, Pi, 3*Pi/2 and so on, rather than the
> conventional integer markings on the axes?
> 
> Regards
> ==
> Muhammad Sabieh Anwar
> Oxford


Muhammad Sabieh Anwar,

to get an overview of your function behavior, look at

In[3]:=
Plot3D[Sin[x]^2 + Tan[y], {y, 0, 2*Pi}, {x, 0, 2*Pi}, PlotPoints ->
{50, 15}]

As to the tabulated values look at

In[4]:= Table[x, {x, 0, 2*Pi}]
Out[4]= {0, 1, 2, 3, 4, 5, 6}

As for the interpretation of the shading look at Help > Graphics and
Sound > Advanced Options > ColorFunction   (and ColorFunctionScaling).
The interpretation of the labels is a bit more difficult: the value
for x=0 is in the cell between {0,1}, the value for x=6 in the cell
between {6,7}.


If you want to have values (and hence demarcations) for rational
multiples of Pi you have to tabulate such:

In[13]:=
ListDensityPlot[
  Table[Sin[x]^2 + Tan[y], {x, 0, 2*Pi, 2*Pi/15}, {y, 0, 2*Pi,
2*Pi/50}],
  ColorFunction -> Hue, 
  MeshRange -> {{0 - Pi/50, 2Pi + Pi/50}, {0 - Pi/15, 2Pi + Pi/15}}]

You have the Option MeshRange at your disposal, however be cautious
applying it. The MeshRange as above is arranged such that you read off
the values at the center of the cells (where the shading is)!

What is still unsatisfactory is the placement of the tick labels, so
make your own!

In[25]:=
ListDensityPlot[
  Table[Sin[x]^2 + Tan[y], {x, 0, 2*Pi, 2*Pi/15}, {y, 0, 2*Pi,
2*Pi/50}],
  ColorFunction -> Hue, 
  FrameTicks -> {Take[Table[x, {x, 0, 2Pi, 2Pi/50}], {1, -1, 5}], 
      Table[x, {x, 0, 2Pi, 2Pi/15}], {}, {}}, 
  MeshRange -> {{0 - Pi/50, 2Pi + Pi/50}, {0 - Pi/15, 2Pi + Pi/15}}]

(enlarge the graphics!)


--
Hartmut Wolf


  • Prev by Date: Re: Trying to solve a sum
  • Next by Date: Re: Reading Color Values from Images Using Mathematica
  • Previous by thread: ListDensityPlot
  • Next by thread: MathLink for Excel (Windows 2000, Office 2000 and Mathematica 4.2