MathGroup Archive 2007

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

Search the Archive

Re: DensityPlot colours misbehaving

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78737] Re: [mg78705] DensityPlot colours misbehaving
  • From: Brett Champion <brettc at wolfram.com>
  • Date: Sun, 8 Jul 2007 06:08:58 -0400 (EDT)
  • References: <200707071005.GAA05698@smc.vnet.net>

On Jul 7, 2007, at 5:05 AM , Tim Birks wrote:

>
> I have Mathematica v6 and am running code that worked fine with v5.  
> OS is
> Windows XP. Here's a particularly annoying unexplained difference  
> between
> the two versions.
>
> DensityPlot[Exp[-x], {x, 0., 4.}, {y, 0., 4.}, ColorFunctionScaling ->
> False]
>
> behaves as expected, giving a nice gradual horizontal grading of  
> colour from
> white on the left to blue/violet on the right.
>
> In contrast,
>
> DensityPlot[Exp[-x - y], {x, 0., 4.}, {y, 0., 4.},  
> ColorFunctionScaling ->
> False]
>
> which should give a similar grading from lower-left to upper-right,  
> instead
> gives a mostly blue/violet field with a pure white triangular wedge  
> in the
> lower-left corner. The discontinuous jump between the two occurs  
> roughly
> where x+y=1.4.
>
> Re-plotting with x and y running from 0 to 2 instead of 4 makes the  
> white
> triangle appear smaller rather than bigger. Note the setting of
> ColorFunctionScaling means that the colour at a particular point (x,y)
> shouldn't depend on what's happening elsewhere; also note that the  
> functions
> plotted are very simple, well-behaved and evaluate to between 0 and  
> 1 in the
> ranges plotted.
>
> Can anyone please explain what is happening, how it can be fixed,  
> and why it
> is not a bug?
>
> Apologies if this has been asked before. I have searched the posts  
> available
> on my news reader and found nothing relevant.

The triangle at the bottom is being clipped by the automatic  
PlotRange calculation.

Compare:

DensityPlot[Exp[-x - y], {x, 0., 4.}, {y, 0., 4.}]
DensityPlot[Exp[-x - y], {x, 0., 4.}, {y, 0., 4.}, ClippingStyle- 
 >Automatic]
DensityPlot[Exp[-x - y], {x, 0., 4.}, {y, 0., 4.}, PlotRange->All]

Brett Champion
Wolfram Research


  • Prev by Date: Re: something funny!
  • Next by Date: Re: Mathematica 6.0.1 Now Available
  • Previous by thread: Re: DensityPlot colours misbehaving
  • Next by thread: Re: DensityPlot colours misbehaving