From: telefunkenvf14 on
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

From: Ryan Gorka on
Patrick and David:

Thanks for the help. Once I generate something I like, such as

DensityPlot[x, {x, -1, 1}, {y, 0, 1}, FrameTicks -> None,
ColorFunction -> (Blend[{{0, Green}, {0.4, White}, {0.6, White}, {1,
Red}}, #] &)]

Do you have any suggestions for the best way (or at least a reasonable way)
to pick a range of x colors from that? I'll probably start with a linear
sampling, although non-linear samplings also interest me---my main goal is
to avoid injecting 'lie factor' via coloring in my diagrams, so any wisdom
you can impart is appreciated. BTW, are there any Edward Tufte fans in here?

I suppose for now I can just use //InputForm, Part[] and go digging for RGB
values.

-RG

On Sun, Jul 25, 2010 at 7:04 PM, Patrick Scheibe <
pscheibe(a)trm.uni-leipzig.de> wrote:

> Hi,
>
> you don't need the (buggy) sample with the Table. Just read a bit in the
> Blend documentation and eventually do something like
>
> DensityPlot[x, {x, -1, 1}, {y, 0, 1}, FrameTicks -> None,
> ColorFunction -> (Blend[{{0, Green}, {0.4, White}, {0.6, White}, {1,
> Red}}, #] &)]
>
> Cheers
> Patrick
>
> On Sun, 2010-07-25 at 01:58 -0400, telefunkenvf14 wrote:
> > 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
> >
>
>
From: David Park on
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(a)comcast.net
http://home.comcast.net/~djmpark/


From: telefunkenvf14 [mailto:rgorka(a)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



From: Patrick Scheibe on
Hi,

to interpolate between the colors red RGBColor[{1,0,0}], green, and
white you really dont need the Blend function. You have 4 values for the
colors

{{0, 1, 0}, {1, 1, 1}, {1, 1, 1}, {1, 0, 0}}

Just interpolate the points and build a function giving you the colors
in range:

f[x_] = Through[(ListInterpolation[#, {{0, 1}}] & /@
Transpose[{{0, 1, 0}, {1, 1, 1}, {1, 1, 1}, {1, 0, 0}}])[x]];
cols[start_, end_, n_] :=
Table[RGBColor[f[i]], {i, start, end, (end - start)/(n - 1)}]

with that you can do

Graphics[Transpose[{cols[0, 1, 20], Table[Disk[{i, 0}], {i, 20}]}],
Background -> Gray]

or just get Colors from White to Red:

In[28]:= cols[0.5, 1, 5]

Out[28]= {RGBColor[{1.0625, 1.0625, 1.125}],
RGBColor[{1.02051, 1.03418, 1.05469}],
RGBColor[{0.960938, 0.882812, 0.84375}],
RGBColor[{0.936523, 0.555664, 0.492187}], RGBColor[{1., 0., 0.}]}

Cheers
Patrick


On Sun, 2010-07-25 at 19:48 -0500, Ryan Gorka wrote:
> Patrick and David:
>
> Thanks for the help. Once I generate something I like, such as
>
> DensityPlot[x, {x, -1, 1}, {y, 0, 1}, FrameTicks -> None,
> ColorFunction -> (Blend[{{0, Green}, {0.4, White}, {0.6, White}, {1,
> Red}}, #] &)]
>
> Do you have any suggestions for the best way (or at least a reasonable
> way) to pick a range of x colors from that? I'll probably start with a
> linear sampling, although non-linear samplings also interest me---my
> main goal is to avoid injecting 'lie factor' via coloring in my
> diagrams, so any wisdom you can impart is appreciated. BTW, are there
> any Edward Tufte fans in here?
>
> I suppose for now I can just use //InputForm, Part[] and go digging
> for RGB values.
>
> -RG
>
> On Sun, Jul 25, 2010 at 7:04 PM, Patrick Scheibe
> <pscheibe(a)trm.uni-leipzig.de> wrote:
> Hi,
>
> you don't need the (buggy) sample with the Table. Just read a
> bit in the
> Blend documentation and eventually do something like
>
> DensityPlot[x, {x, -1, 1}, {y, 0, 1}, FrameTicks -> None,
> ColorFunction -> (Blend[{{0, Green}, {0.4, White}, {0.6,
> White}, {1,
> Red}}, #] &)]
>
> Cheers
> Patrick
>
>
> On Sun, 2010-07-25 at 01:58 -0400, telefunkenvf14 wrote:
> > 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
> >
>
>
>


From: Patrick Scheibe on
Hi,

you don't need the (buggy) sample with the Table. Just read a bit in the
Blend documentation and eventually do something like

DensityPlot[x, {x, -1, 1}, {y, 0, 1}, FrameTicks -> None,
ColorFunction -> (Blend[{{0, Green}, {0.4, White}, {0.6, White}, {1,
Red}}, #] &)]

Cheers
Patrick

On Sun, 2010-07-25 at 01:58 -0400, telefunkenvf14 wrote:
> 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
>