MathGroup Archive 1996

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

Search the Archive

Re: help with graphics command

  • Subject: [mg2882] Re: [mg2874] help with graphics command
  • From: twj (Tom Wickham-Jones)
  • Date: 4 Jan 1996 04:10:42 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: mj at wri.com



>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





  • Prev by Date: Re: help with graphics command
  • Next by Date: Re: Problems with Outer
  • Previous by thread: Re: help with graphics command
  • Next by thread: Re: Mathematica vs ?