MathGroup Archive 2010

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

Search the Archive

Re: Putting a Plot inside a Graphics function with other drawings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108093] Re: [mg108071] Putting a Plot inside a Graphics function with other drawings
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 8 Mar 2010 06:13:27 -0500 (EST)
  • References: <12832866.1267957117798.JavaMail.root@n11>

It's what I call Graphics level jumping. Plots go by themselves and
primitives go inside Graphics and they all go in a Show. So you could do
this:

Show[
 Plot[Sin[x], {x, 0, 2 Pi}],
 Graphics[{Opacity[.5, Red], Disk[{Pi, 0}, 1/2]}]] 

Or you could do this:

Show[
 Graphics[{Opacity[.5, Red], Disk[{Pi, 0}, 1/2]}],
 Plot[Sin[x], {x, 0, 2 Pi}]] 

Or you could use Plot with an Epilog (but then what if you want another
Plot?):

Plot[Sin[x], {x, 0, 2 Pi},
 Epilog -> {Opacity[.5, Red], Disk[{Pi, 0}, 1/2]}] 

Clearly with Show you have to be careful about the order of the items and/or
look to the overall plot options.

Or you could use the Presentations package where you just draw one thing
after another and none of the overall plot options come from the parts.

Needs["Presentations`Master`"] 

Draw2D[
 {Draw[Sin[x], {x, 0, 2 Pi}],
  Opacity[.5, Red],
  Disk[{Pi, 0}, 1/2]},
 Frame -> True] 


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: cool-RR [mailto:ram.rachum at gmail.com] 


Hello,

(Please ignore my earlier question about plot markers, I already
figured it out, thanks.)

I am trying to combine a Plot with other graphics elements. I've tried
doing Graphics[{Plot[whatever], Disk[whatever]}], but it's saying that
"Graphics is not a Graphics directive." (Probably because Plot already
applies Graphics itself.)

How do I do this?

Thanks for your time,
Ram Rachum




  • Prev by Date: Re: Modification of Variable in NDSolve
  • Next by Date: Re: Re: Mathematica and LaTeX
  • Previous by thread: Re: Putting a Plot inside a Graphics function with other drawings
  • Next by thread: Re: Putting a Plot inside a Graphics function with other drawings