Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*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 2003

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

Search the Archive

Re: Bug in ColorFunctionScaling ???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39431] Re: Bug in ColorFunctionScaling ???
  • From: Bill Rowe <bjrowe at earthlink.net>
  • Date: Fri, 14 Feb 2003 03:26:18 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 2/13/03 at 4:54 AM, guerra_cesar at yahoo.com (Cesar Guerra) wrote:

>working with the matrix given at the end of this mail I had troubles
>trying to visualize it. For instance

>ListDensityPlot[matrix]

>works too bad as can be seen using a 3D chart

><<Graphics`Graphics3D`

>BarChart3D[matrix]

>I got the correct density plot when I scaled the matrix elements by
>hand:

>min = Min[matrix];

>max = Max[matrix];

>ListDensityPlot[matrix,ColorFunctionScaling->False,ColorFunction->(
>GrayLevel[(#-min)/(max-min)]&)];

>The question: is it a bug or I lost something in the way? A similar
>problem arises with many matrices that I generated in which there are
>many numbres close to zero.

I don't think it is a bug in the ColorFunction. Instead, I think it is another instance of Mathematica trying to show what it considers the interesting aspects of a plot.

Most of the values in the matrix you posted were very close to zero. That makes the few values close to one appear as outliers. I think Mathematica is first ignoring the few large values then scaling the colors to the range of the remaining values. So, you see a larger white area in the density plot reflecting this. When you use a specific ColorFunction to scale the colors to the entire data range you override the default action and it is as if Mathematica did not clip the high values.

If I have this right, you are always going to see this whenever you have a large dynamic range with most elements at one end of the range.

If the values are always positive as they were in the matrix you posted, you might want to consider visualizing the matrix as ListDensityPlot[Log[matrix]]. The Log function will compress the dynamic range making it more likely Mathematica can meaningfully represent all of the values in the matrix.

Antother alternative would be ListContourPlot[Log[matrix]].


  • Prev by Date: Porting Mathematica graphics to MicroSoft Point, with quality
  • Next by Date: Re: Simple List question. HELP.
  • Previous by thread: Re: Bug in ColorFunctionScaling ???
  • Next by thread: RE: Bug in ColorFunctionScaling ???