Re: Gradient fill as Background for Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg89687] Re: Gradient fill as Background for Plot
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 18 Jun 2008 04:23:33 -0400 (EDT)
- References: <g3033p$maq$1@smc.vnet.net> <g32q8b$c4c$1@smc.vnet.net> <g35g4l$9fb$1@smc.vnet.net>
Thanks for pointing out the use of VertexColors.
On your last question you could take the First part of DensityPlot to obtain
the primitives.
Plot[-1/x, {x, -1, 0},
Prolog -> {First@DensityPlot[12 x - y, {x, -1, 0}, {y, 0, 12.2}]},
PlotRangeClipping -> False]
The regular Mathematica graphics paradigm presents a barrier to many users
because to make custom plots and geometric diagrams it is necessary to jump
between graphical levels using various combinations of Show, Graphics,
Prolog, Epilog and First. It's not that it's terribly difficult to do this
but it's enough to stop many users. The Presentations package converts
everything to graphical primitives so there is a uniform simple syntax for
doing graphics. You can combine primitives and curves or surfaces together
in one container. You just draw one thing after another. You don't have to
use Show, Graphics, Prolog, Epilog or First. So, for your two plots we could
use the following.
Needs["Presentations`Master`"]
Combining graphical primitives with a Plot curve:
Draw2D[
{Polygon[{ImageScaled[{0, 0}], ImageScaled[{1, 0}],
ImageScaled[{1, 1}], ImageScaled[{0, 1}]},
VertexColors -> {LightYellow, Yellow, LightYellow, White}],
Draw[-1/x, {x, -1, 0}]},
AspectRatio -> .6,
Axes -> True]
Combining a DensityPlot with a Plot curve:
Draw2D[
{DensityDraw[12 x - y, {x, -1, 0}, {y, 0, 12.2}],
Draw[-1/x, {x, -1, 0}]},
AspectRatio -> .6,
Axes -> True]
--
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
<lehin.p at gmail.com> wrote in message news:g35g4l$9fb$1 at smc.vnet.net...
>
> Thank you for the idea! Just now I have found very nice particular
> ready-for-use solution in the Documentation Center! It is located on
> "Prolog" page under "Applications" field. It is:
>
> bg = Polygon[{ImageScaled[{0, 0}], ImageScaled[{1, 0}],
> ImageScaled[{1, 1}], ImageScaled[{0, 1}]},
> VertexColors -> {LightYellow, LightYellow, LightYellow, White}];
> Plot[-1/x, {x, -1, 0}, Prolog -> bg, PlotRangeClipping -> False]
>
> As I understand there should be some way for using DensityPlot as
> Prolog but DensityPlot is not a list of graphics primitives and so may
> not be directly passed to Prolog. Does anyone know how to convert
> DensityPlot for using as Prolog?
>
>