Re: Gradient fill as Background for Plot

• To: mathgroup at smc.vnet.net
• Subject: [mg89628] Re: Gradient fill as Background for Plot
• From: "David Park" <djmpark at comcast.net>
• Date: Sun, 15 Jun 2008 06:14:48 -0400 (EDT)
• References: <g3033p\$maq\$1@smc.vnet.net>

```You can use a DensityPlot as a background. But you may want to specify the
specific PlotRange so it will coordinate with the other plot elements. Here
is how I would do it with the Presentations package. We just draw the
background first and then put the other plot elements on top of it. Rescale
is a convenient method to control what values are fed to the color function.

Needs["Presentations`Master`"]

Draw2D[
{DensityDraw[
Rescale[-Rescale[x, {-1, 0}] + Rescale[y, {0, 12}], {-1,
1}], {x, -1, 0}, {y, 0, 12},
ColorFunctionScaling -> False,
ColorFunction -> (Blend[{Yellow, White}, #] &)
],
Draw[-1/x, {x, -1, 0}]},
AspectRatio -> 1/2,
Frame -> True]

For something more colorful you could try:

Draw2D[
{DensityDraw[
Rescale[-Rescale[x, {-1, 0}] + Rescale[y, {0, 12}], {-1,
1}], {x, -1, 0}, {y, 0, 12},
ColorFunctionScaling -> False,
ColorFunction -> ColorData["BeachColors"]
],
Draw[-1/x, {x, -1, 0}]},
AspectRatio -> 1/2,
Frame -> True]

Since you can make the DensityPlot anything you want you can have any kind
of background.

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

<lehin.p at gmail.com> wrote in message news:g3033p\$maq\$1 at smc.vnet.net...
> Hello,
> I wish Plot to have gradient fill background (from right bottom to
> left top the fill color becomes lighter). I hope there is simple
> solution but I did not find in the Documentation any example for
> this.
> I have found a simple nice solution for uniform fill:
> Plot[-1/x, {x, -1, 0}, Background -> Lighter[Yellow, .8]]
> But I have not find how to make gradient fill.
> Does anyone know a solution?
>
> P.S. More commonly, I would like to know (if it is possible) how I can
> specify any arbitrary (may be piecewise) function for filling the
> Background.
>

```

• Prev by Date: Re: How to make an InputField inside of a graphic active...
• Next by Date: Re: Re: export pdf font question
• Previous by thread: Gradient fill as Background for Plot
• Next by thread: Re: Gradient fill as Background for Plot