MathGroup Archive 2000

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

Search the Archive

Re: ContourPlots,DensityPlots

  • To: mathgroup at
  • Subject: [mg23615] Re: ContourPlots,DensityPlots
  • From: "Atul Sharma" <atulksharma at>
  • Date: Wed, 24 May 2000 02:16:16 -0400 (EDT)
  • Organization: McGill University
  • References: <8g5frm$>
  • Sender: owner-wri-mathgroup at

Bob Hanlon's answer as usual is concise and effective. One objection that I
have had to using the color function Hue is that Hue[0] and Hue[1] both
appear as red, which confuses (me at least). For this reason, I usually
replace Hue[#] with Hue[1-#/2], so as to assign unique colors. Modifying
Bob's solution to accomodate this minor prejudice of my own gives the
following, which scales your contours between blue and red. A similar
scaling could be accomplished with RGBColor[0.3+ 0.7 #, 0.4, 0.8]

I found Chapter 4 in Stan Wagon's book an excellent introduction to these
color scales. HTH.

A.S. :

data = Table[
      10.*Sin[x + y]Cos[x - y], {x, xmin = -Pi, xmax = Pi, Pi/24.}, {y,
        ymin = -Pi, ymax = Pi, Pi/24.}];
Plot3D[10Sin[x + y]Cos[x - y], {x, xmin, xmax}, {y, ymin, ymax},
    PlotPoints -> 25];
    ListContourPlot[data, ColorFunction -> (Hue[1 - #/2] &), Contours -> 12,
      ContourLines -> False, DisplayFunction -> Identity], {Hue[1 - #/2] &,
      11, ToString[Max[data]], ToString[Min[data]],
      LegendPosition -> {1.1, -.4}}];
    ListDensityPlot[data, ColorFunction -> (Hue[1 - #/2] &), Mesh -> False,
      DisplayFunction -> Identity], {Hue[1 - #/2] &, 11,
      ToString[Min[data]], LegendPosition -> {1.1, -.4}}];

Atul Sharma MD, FRCP(C)
Pediatric Nephrologist,
McGill University/Montreal Children's Hospital

Paul Hoke wrote in message <8g5frm$gbq at>...
>Anybody have a lot of experience with ListContourPlot and
>I have a matrix of data I want to plot and show for a presentation.
>The problems I am having are as follows
>with ColorFunctionScaling->True, It doesn't seem that the colors have
>any thing to do with the actual values if I use a legend and use
>ColorFunction->Hue, the scale is on the plot doesn't equal the legend
>since the data is truncated to fit 0-1.
>I'm trying to divide by the largest value since all my data is positive
>and then the legend color scheme should fit the data plot except I don't
>have a zero in my data to peg the lower end.  I hate to add a zero in my
>matrix just to fix the lower end of the color scheme, is that the only
>I can delineate which contours I want, but I can't label them.  Is there
>anyway to print the value of contours?  That is on the plot have each
>contour marked so that it isn't just a bunch of lines?
>Thanks in advance,
>Paul Hoke
>A107 Research Complex Engineering
>Michigan State University
>East Lansing MI 48824
>Hokepaul at
>Office 517.353.9952
>Lab 517.353.6434
>Fax 517.353.7179

  • Prev by Date: AW: Re: Dirichlet function plot
  • Next by Date: Re: sending notebooks as attatchments with microsoft OutlookExpress...
  • Previous by thread: Re: ContourPlots,DensityPlots
  • Next by thread: bug in InequalitySolve version 3?