Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Documentation on (Color) Blend

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111271] Re: Documentation on (Color) Blend
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 26 Jul 2010 06:35:26 -0400 (EDT)

For DensityPlot, the value of the argument supplied to the ColorFunction is
f, the plot function value. This is in the ColorFunction notes. In this case
it is x. You can use Rescale to control the domain of x that maps into 0 to
1.

DensityPlot[x, {x, -2, 3}, {y, 0, 1},
 FrameTicks -> None,
 ColorFunction -> (Blend[{Red, Green}, Rescale[#, {-2, 3}]] &), 
 ColorFunctionScaling -> False] 

If you evaluate the Help example you will see that the original output shown
is incorrect and one actually gets what you do get. This must be a case
where WRI updated the function but not the Function page.

The following maps 0 < x < 1 to the full Blend range, and values of x
outside the domain go to the limiting color.

DensityPlot[x, {x, -2, 3}, {y, 0, 1},
 FrameTicks -> None,
 ColorFunction -> (Blend[{Red, Green}, Rescale[#, {0, 1}]] &), 
 ColorFunctionScaling -> False] 


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: telefunkenvf14 [mailto:rgorka at gmail.com] 

Group:

The documentation on Blend[], in the "Possible Issues" section,
contains the following example.

 ----------------
In plot functions, use ColorFunctionScaling to control global scaling
of variables:

Table[DensityPlot[x, {x, -2, 3}, {y, 0, 1}, FrameTicks -> None,
  ColorFunction -> (Blend[{Red, Green}, #] &),
  ColorFunctionScaling -> t], {t, {False, True}}]
 ----------------

I noticed that when I evaluate the code, the original output is not
reproduced. On my machine the new plots look exactly the same.
(Windows 7, 64-bit, Mathematica 7.0.1)

Can someone offer a fix? My goal is to generate a Green to White to
Red spectrum with a 'fuzzier' center; eventually I'll use this for
coloring a map.

-RG




  • Prev by Date: Re: Linking my fortran subroutines with Mathematica
  • Next by Date: Re: A Question About Directive [off-topic]
  • Previous by thread: Re: Documentation on (Color) Blend
  • Next by thread: Re: Documentation on (Color) Blend