       Re: help with graphics command

• To: mathgroup at smc.vnet.net
• Subject: [mg2882] Re: [mg2874] help with graphics command
• From: Tom Wickham-Jones <twj>
• Date: Thu, 4 Jan 1996 03:05:18 -0500

```
>I am trying to plot a sine wave with the middle portion grayed out.  The Plot command seems

>like the way to go, but I can't figure out how to get my rectangle to come out

>in like a GrayLevel[0.5]. (See syntax below)  Is it possible to adjust the

>shade of gray on the rectangle?  I'm working off the example on page 413 of

>the mathematica book.

>
>If it is not possible to adjust the shade used with this command, can you suggest an
> alternate way?
>
>
>Plot[Sin[x]*50, {x, 0, 2Pi}, Prolog -> Rectangle[Scaled[{0.02, 0.25} ] ,

>	Scaled[{1, 0.75}] ]]

The argument of the Prolog option can be any collection of graphics
primitives and style directives.  If there are more than one they must
be placed in a list.

Plot[Sin[x]*50, {x, 0, 2Pi},

Prolog -> {GrayLevel[0.5],

Rectangle[Scaled[{0.02, 0.25} ] ,

Scaled[{1, 0.75}] ]}]

With this the GrayLevel[0.5] is also used to draw the plot.
To prevent the plot from being colored the Prolog argument
can be placed in one more level of lists.

Plot[Sin[x]*50, {x, 0, 2Pi},

Prolog -> {{GrayLevel[0.5],

Rectangle[Scaled[{0.02, 0.25} ] ,

Scaled[{1, 0.75}] ]}}]

In this case using Frame axes may improve the picture.

Plot[Sin[x]*50, {x, 0, 2Pi},

Frame -> True, Axes -> False,
Prolog -> {{GrayLevel[0.5],

Rectangle[Scaled[{0.02, 0.25} ] ,

Scaled[{0.98, 0.75}] ]}}]

Tom Wickham-Jones
WRI

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Mathematica Workshops in Colorado Feb. 25-28
• Next by Date: Re: help with graphics command
• Previous by thread: help with graphics command
• Next by thread: Re: help with graphics command