MathGroup Archive 2008

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

Search the Archive

Re: Plotting ListDensityPlot with Custom Color Scheme

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91937] Re: Plotting ListDensityPlot with Custom Color Scheme
  • From: Bill Rowe <wjrowe at sbcglobal.net>
  • Date: Sat, 13 Sep 2008 05:55:53 -0400 (EDT)

On 9/12/08 at 5:27 AM, buzb at mac.com (Buz Barstow) wrote:

>I'm trying to plot out a color map of a matrix with a custom color
>scheme, and add a legend to it.

>The maximum value in the matrix is approximately 1.7, and the lowest
>value is -2.7. Most of the values lie in the range -0.5 to +0.5.

>When Mathematica 6.0 produces a ListDensityPlot of this matrix, it
>color codes most of the plot, but it leaves large areas with
>"overflow" colors - some of the plot is displayed as white, not on
>the color map.

>I'd like to be able to rescale the color function so that it spans
>the range -2.7 to 1.7, and produce a legend for the plot that
>accurately reflects this.

So, use the built-in function Rescale. For example,

ColorFunction->(Hue@Rescale[#,{-2.7,1.7}]&)

will eliminate the white areas. But note, this choice maps both
minimum and maximum values to the same color. So, it is probably
not one you want. Better might be

ColorFunction->(ColorData["TemperatureMap"][Rescale[#,{-2.7,1.7}]]&)


  • Prev by Date: Functional programming?
  • Next by Date: How can you get the list of
  • Previous by thread: Plotting ListDensityPlot with Custom Color Scheme
  • Next by thread: Re: Plotting ListDensityPlot with Custom Color Scheme