MathGroup Archive 2003

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

Search the Archive

Re: Changing the shading contrast in ListContourPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42369] Re: [mg42331] Changing the shading contrast in ListContourPlot
  • From: "Y.A.Tesiram" <yas at pcomm.hfi.unimelb.edu.au>
  • Date: Wed, 2 Jul 2003 06:36:31 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

G'day,
You can use ColorFunction to color according to your scale and use
ColorFunctionScaling->False so that your scaling is used instead of the
default.

And example follows;
(*some packages you will need*)

<< Graphics`Graphics`
<< Graphics`Legend`

(*some data*)

c1 = Table[x + Cos[x  y], {x, -4.0, 4.0, 0.1}, {y, -3.0, 0, 0.1}];
c2 = Table[x + Cos[x  y], {x, -1.0, 1.0, 0.1}, {y, 0.0, 1, 0.1}];

(*check range of data*)
(*your data set is different by a factor of 10 so coloring may be
difficult *)

Min[c1]
Max[c1]
Min[c2]
Max[c2]

(* draw the fist picture with color legend *)

fig1 = ShowLegend[
    ListContourPlot[c1,
    ColorFunction -> (Hue[(#^2)/Max[c1^2]] &),
      ColorFunctionScaling -> False,
        Contours -> 20, DisplayFunction -> Identity],
    {Hue[#] &, 10, "Max", "Min",
      LegendPosition -> {1.1, -.4}}
    ]

(* draw the second picture with color legend*)

fig2 = ShowLegend[
    ListContourPlot[c2,
    ColorFunction -> (Hue[(#^2)/Max[c1^2]] &),
      ColorFunctionScaling -> False,
        Contours -> 20, DisplayFunction -> Identity],
    {Hue[#] &, 10, "Max", "Min",
      LegendPosition -> {1.1, -.4}}
    ]

(* one way of showing the picture *)

Show[GraphicsArray[{fig1, fig2}], ImageSize -> 600]


You may have to fiddle around with the ColorFunction function I have used
to make the data lie in the range that Hue and GrayLevel will accept.
Alternatively you can use ListDensityPlot in place of ListContourPlot with
Mesh->False to do the same plots.
Also, if you draw the graphic without the Legend, you can use
DisplayToether to show the two graphs and the smaller one will scale into
the larger one. But of course you lose some of the larger picture.


Yas



On Tue, 1 Jul 2003, JJJ Shen wrote:

> Hi, I encountered a question in ListContourPlot and am writing for help and
> advice.
>
> I have two sets of data, which have different ranges in x- and y-. (Say, one
> set of data is from {{-4,4}, {-3,0}}, while another set is from {{-1,1}, {0,
> 1}}) and the z value for the first set is from, say, 0 to 100; while the z
> value for the second set is from, say, 0 to 20.
>
> When I do
>
> ListContourPlot[data1]; ListContourPlot[data2]
>
> both plots have the shading from black to white, but apparently the white
> regions corresponding to very different z value! (in first plot, white
> corresponds to (roughly) 100 while in second set it's about 20!) The problem
> here is that both data sets have different x- and y- range so I cannot
> combine them to get one big data set.
>
> I was wondering if there's a way to "change/downgrade" the shading of the
> 2nd data set? So that the shading of the contour plot of the second data set
> so the shading can be used to compare with the contour plot from the first
> data set?
>
> I'd also appreciate any suggestions on better ways to present the plots.
> Thanks for your time in advance.
>
> Sincerely,
> JT
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>


  • Prev by Date: RE: Changing the shading contrast in ListContourPlot
  • Next by Date: variable definition help
  • Previous by thread: RE: Changing the shading contrast in ListContourPlot
  • Next by thread: ran2 from numerical recipes