Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

RE: Extended ListContourPlot and ContourShading

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28574] RE: [mg28551] Extended ListContourPlot and ContourShading
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 28 Apr 2001 21:36:00 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Alison,

I believe that the ExtendGraphics ListContourPlot does not provide for
shading when you use its features. There is probably a reason for this.
Perhaps that it is much easier to generate the lines than the polygons. In
any case, I think the following solution, which also uses ExtendGraphics may
work.

Needs["ExtendGraphics`TriangularInterpolate`"]

The function in your example is just x y. Here is a set of data obtained by
sampling at 1000 points. I added sample points at the four corners of the
square just to force the range to be
{{x,-1,1},{y,-1,1}}. If you are using experimental data, you will probably
have to check for the minimun and maximum values of x and y and tailor your
plot to those values.

d2 = Join[
      Module[{x, y},
        Table[{x = Random[Real, {-1, 1}], y = Random[Real, {-1, 1}],
            x y}, {1000}]],
      Flatten[Outer[{#1, #2, #1 #2} &, {-1, 1}, {-1, 1}], 1]];

This generates a TriangularInterpolation function.

d3 = TriangularInterpolate[d2]
TriangularInterpolating[ <> ]

Now, we generate an array of data with even spacings. This was rather slow.

d4 = Table[d3[x, y], {x, -1, 1, 0.1}, {y, -1, 1, 0.1}];

Now, we can use the regular ListContourPlot with all its features.

ListContourPlot[d4, ColorFunction -> Hue];

On the other hand, if your problem is really to make plots in the xy-plane
of functions defined in polar coordinates, I would have better suggestions.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

> From: Alison Musgrave [mailto:stores at maths.tcd.ie]
To: mathgroup at smc.vnet.net
>
> Hi,
>
> I have been using the ExtendGraphics`Contour` version
> of ListContourPlot to generate contour plots from a
> list of (x,y,z) irregularly space data points. ContourShading
> does not appear to work with this extended option: try the example
> in "Mathematica Graphics" pg 483,
>
>
> Needs["ExtendGraphics`Contour`"]
>
> d1 = Flatten[
>       Table[Table[{r Sin[t], r Cos[t], r^2 Cos[t] Sin[t]}, {t, 0,
>             2Pi - 2Pi/(10r), 2Pi/(10r)}], {r, 10}], 1];
>
> c = ListContourPlot[d1]
>
>
> ContourShading -> True does not work. Nor does ColorFunction.
> Please note that this is only a problem for data entered in
> (x,y,z) format and NOT for data in array format (compare
> ListContourPlot[Table[x^2 + y^2, {x, -2, 2, .1}, {y, -2, 2, .1}]]).
> Any ideas?
>
> Many thanks,
> Alison Musgrave
> musgrava at tcd.ie
>
>



  • Prev by Date: Re: Re: how to be as efficient as Mean[list] - efficient summing of function applied to list
  • Next by Date: Calculating PI
  • Previous by thread: Extended ListContourPlot and ContourShading
  • Next by thread: Not easy List transformation