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.
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
djm...@comcast.net
http://home.comcast.net/~djmpark/
<leh...@gmail.com> wrote in message news:g3033p$maq$1...@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?
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
djm...@comcast.net
http://home.comcast.net/~djmpark/
<leh...@gmail.com> wrote in message news:g35g4l$9fb$1...@smc.vnet.net...
Thank you very much! It is simple and straightforward! But there
appears additional question: how to make this DensityPlot-background
to fill all image? The option "PlotRangeClipping -> False" gives only
little help. The axes in the Plot gets out of the DensityPlot-
background. I have tried "ImageSize" option for DensityPlot but it
does nothing in this case.
> The regular Mathematica graphics paradigm presents a barrier to many user=
s
> because to make custom plots and geometric diagrams it is necessary to ju=
mp
> between graphical levels using various combinations of Show, Graphics,
> Prolog, Epilog and First. It's not that it's terribly difficult to do thi=
s
> but it's enough to stop many users. The Presentations package converts
> everything to graphical primitives so there is a uniform simple syntax fo=
r
> doing graphics. You can combine primitives and curves or surfaces togethe=
r
> in one container. You just draw one thing after another. You don't have t=
o
> use Show, Graphics, Prolog, Epilog or First. So, for your two plots we co=
uld
> 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
> djmp...@comcast.nethttp://home.comcast.net/~djmpark/
It is interesting but Draw2D also produces graphical primitives? Or it
simply converts any passed Graphics-object to graphical primitives?