[Date Index]
[Thread Index]
[Author Index]
Re: Marking a (rectangular) zone in a standard 2D plot using "Rectangle"
*To*: mathgroup at smc.vnet.net
*Subject*: [mg49798] Re: Marking a (rectangular) zone in a standard 2D plot using "Rectangle"
*From*: "Peltio" <peltio at twilight.zone>
*Date*: Sun, 1 Aug 2004 04:10:01 -0400 (EDT)
*References*: <cearct$au6$1@smc.vnet.net>
*Reply-to*: "Peltio" <peltioNOSP at Mdespammed.com.invalid>
*Sender*: owner-wri-mathgroup at wolfram.com
"Rainer" wrote
> p[1]=Plot[f[x], ..., DisplayFunction -> Identity);
> p[2] = Show[Graphics[Rectangle[{xmin, ymin}, {xmax,ymax}],
> ColorOutput -> RGBColor[1, 0, 0], DisplayFunction -> Identity];
> Show[{p[1], p[2]}, DisplayFunction -> $DisplayFunction];
>* I do not know how to change the color of the rectangle. Obviously
>"ColorOutput" is not the right option ...
Nope. Try to specify a graphic directive. This way:
p[2] = Show[Graphics[
{ RGBColor[1, 1, 0], Rectangle[{xmin, ymin}, {xmax,ymax}] },
DisplayFunction -> Identity]
];
>* If I change the order in the above Show command: p[2],p[1] instead
>of p[1],p[2], the rectangle is in the background but the axes of the
>2d plot and all its grid lines vanish.
Yep, Show inherits the options of the first plot passed to it. But we can
pass to it the options of the second plot by copying them into a list
p[1] = Plot[f[x], {x, a, b}, DisplayFunction -> Identity];
opts1=Options[p[1]];
and then transforming that List into a Sequence. Now inverting the order
of the plots should get you what you asked for:
Show[{p[2], p[1]},
DisplayFunction -> $DisplayFunction, Sequence @@ opt1];
But a faster way to do all of the above would be this:
Plot[f[x], {x, a, b},
Prolog -> {
{RGBColor[1, 1, 0], Rectangle[{xmin, ymin}, {xmax,ymax}]}
}
];
Don't forget the double braces, or the color directive will extend to the
whole plot.
cheers,
Peltio
Invalid address in reply-to. Crafty demunging required to mail me.
Prev by Date:
**Re: Re: contains 208,987,640 decimal digits (was: Fibonachi[5,000,000] contains 1044938 decimal digits)**
Next by Date:
**RE: Re: 3D graphs with constraints**
Previous by thread:
**Re: Re: Re: contains 208,987,640 decimal digits (was: Fibonachi[5,000,000] contains 1044938 decimal digits)**
Next by thread:
**Re: Marking a (rectangular) zone in a standard 2D plot using "Rectangle"**
| |