From: eric g on
Hello Group,
I want to add a color grayscale
(myColorFunction[x_]:=RGBColor[1-x,1-x,1-x]) legend this arrayplot, from
min (white) to max (dark) values.

ArrayPlot[Table[5./(1 + x^2 + y^2), {x, -5, 5}, {y, -5, 5}], Frame -> None]

best regards,
eric

From: Bill Rowe on
On 6/19/10 at 7:49 AM, eric.phys(a)gmail.com (eric g) wrote:

>Hello Group, I want to add a color grayscale
>(myColorFunction[x_]:=RGBColor[1-x,1-x,1-x]) legend this arrayplot,
>from min (white) to max (dark) values.

>ArrayPlot[Table[5./(1 + x^2 + y^2), {x, -5, 5}, {y, -5, 5}], Frame
>-> None]

Perhaps something like

Grid[{{ArrayPlot[Table[5./(1 + x^2 + y^2), {x, -5, 5}, {y, -5, 5}],
Frame -> None]}, {Graphics[Raster[{Reverse(a)Range[50]/50}],
AspectRatio -> .1]}, {.1, 1}}, Alignment -> {{Left, Right}}]


From: Bob Hanlon on

Needs["PlotLegends`"]

ShowLegend[
ArrayPlot[
Table[5./(1 + x^2 + y^2),
{x, -5, 5}, {y, -5, 5}],
Frame -> None,
ColorFunction ->
Function[{a},
RGBColor[1 - a, 1 - a, 1 - a]]],
{Function[{a},
RGBColor[a, a, a]],
11, " 5", " 0",
LegendPosition -> {1.1, -0.4}}]


Bob Hanlon

---- eric g <eric.phys(a)gmail.com> wrote:

=============
Hello Group,
I want to add a color grayscale
(myColorFunction[x_]:=RGBColor[1-x,1-x,1-x]) legend this arrayplot, from
min (white) to max (dark) values.

ArrayPlot[Table[5./(1 + x^2 + y^2), {x, -5, 5}, {y, -5, 5}], Frame -> None]

best regards,
eric


From: Kevin J. McCann on
Bob,

The problem I have with this approach is that you have to give, in text,
the min and max labels for the plot. This is clearly a place where
errors can occur. It would be really great if all you had to do was to
specify the min and max of the z-axis (color scale) and the legend
automatically incorporated this.

Kevin

Bob Hanlon wrote:
> Needs["PlotLegends`"]
>
> ShowLegend[
> ArrayPlot[
> Table[5./(1 + x^2 + y^2),
> {x, -5, 5}, {y, -5, 5}],
> Frame -> None,
> ColorFunction ->
> Function[{a},
> RGBColor[1 - a, 1 - a, 1 - a]]],
> {Function[{a},
> RGBColor[a, a, a]],
> 11, " 5", " 0",
> LegendPosition -> {1.1, -0.4}}]
>
>
> Bob Hanlon
>
> ---- eric g <eric.phys(a)gmail.com> wrote:
>
> =============
> Hello Group,
> I want to add a color grayscale
> (myColorFunction[x_]:=RGBColor[1-x,1-x,1-x]) legend this arrayplot, from
> min (white) to max (dark) values.
>
> ArrayPlot[Table[5./(1 + x^2 + y^2), {x, -5, 5}, {y, -5, 5}], Frame -> None]
>
> best regards,
> eric
>
>

From: Bob Hanlon on

It you want it to do more, just tell it so.

Needs["PlotLegends`"]

arrayPlot[expr_, iterX_, iterY_] :=
Module[
{x = iterX[[1]], y = iterY[[1]],
min, max, cons},
cons = LessEqual @@ (#[[{2, 1, 3}]]) & /@
{iterX, iterY};
min = ToString[Round[
NMinimize[{expr, cons},
{x, y}][[1]] // Chop, 0.1]];
max = ToString[Round[
NMaximize[{expr, cons},
{x, y}][[1]] // Chop, 0.1]];
ShowLegend[
ArrayPlot[
Table[5./(1 + x^2 + y^2),
iterX, iterY],
Frame -> None,
ColorFunction ->
Function[{a},
RGBColor[1 - a, 1 - a, 1 - a]]],
{Function[{a},
RGBColor[a, a, a]], 11, max, min,
LegendPosition -> {1.1, -0.4}}]]

m = RandomInteger[{5, 25}]

10

arrayPlot[m/(1 + x^2 + y^2),
{x, -5, 5}, {y, -5, 5}]


Bob Hanlon

---- "Kevin J. McCann" <kjm(a)KevinMcCann.com> wrote:

=============
Bob,

The problem I have with this approach is that you have to give, in text,
the min and max labels for the plot. This is clearly a place where
errors can occur. It would be really great if all you had to do was to
specify the min and max of the z-axis (color scale) and the legend
automatically incorporated this.

Kevin

Bob Hanlon wrote:
> Needs["PlotLegends`"]
>
> ShowLegend[
> ArrayPlot[
> Table[5./(1 + x^2 + y^2),
> {x, -5, 5}, {y, -5, 5}],
> Frame -> None,
> ColorFunction ->
> Function[{a},
> RGBColor[1 - a, 1 - a, 1 - a]]],
> {Function[{a},
> RGBColor[a, a, a]],
> 11, " 5", " 0",
> LegendPosition -> {1.1, -0.4}}]
>
>
> Bob Hanlon
>
> ---- eric g <eric.phys(a)gmail.com> wrote:
>
> =============
> Hello Group,
> I want to add a color grayscale
> (myColorFunction[x_]:=RGBColor[1-x,1-x,1-x]) legend this arrayplot, from
> min (white) to max (dark) values.
>
> ArrayPlot[Table[5./(1 + x^2 + y^2), {x, -5, 5}, {y, -5, 5}], Frame -> None]
>
> best regards,
> eric
>