MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Marking a (rectangular) zone in a standard 2D plot using "Rectangle"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49740] Marking a (rectangular) zone in a standard 2D plot using "Rectangle"
  • From: wilhelm.rainer at gmx.net (Rainer)
  • Date: Thu, 29 Jul 2004 07:46:02 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
I'd like to mark a rectangular zone {{xmin,ymin},{xmax,ymax}} in a
standard 2D-plot (of a mathematical function) by a coloured rectangle
(e.g. in bright yellow). This is to highlight a part of the plot. To
do this, I have tried the following:

First I created the plot of the function (defined as f[x]):

p[1]=Plot[f[x], ..., DisplayFunction -> Identity);

The option "DisplayFunction -> Identity" tells Mathematica *not* to
plot immediately.
Then I create the rectangle using:

p[2] = Show[Graphics[Rectangle[{xmin, ymin}, {xmax,ymax}],
    ColorOutput -> RGBColor[1, 0, 0], DisplayFunction -> Identity];

Finally I am plotting both of them using:

Show[{p[1], p[2]}, DisplayFunction -> $DisplayFunction];

The problems are:

* The rectangle overlaps the 2-D-plot, and I would like to use it just
as a "transparent" background, i.e. I would like that the curve of
f[x] stays visible in the highlighted zone.

* I do not know how to change the color of the rectangle. Obviously
"ColorOutput" is not the right option ... I've also tried
ColorFunction but also that one does not do what I'd like it to do.

* 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.

I appreciate any helpful comment!
Thanks
Rainer


  • Prev by Date: Re: Combinations
  • Next by Date: RE: Q: extract all k-tuple from a list of n elements
  • Previous by thread: Re: ListDensityPlot, ColorFunction, and associated confusions
  • Next by thread: Re: Marking a (rectangular) zone in a standard 2D plot using "Rectangle"