From: cool-RR on
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

From: David Park on
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(a)comcast.net
http://home.comcast.net/~djmpark/


From: cool-RR [mailto:ram.rachum(a)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



From: Bill Rowe on
On 3/7/10 at 5:10 AM, ram.rachum(a)gmail.com (cool-RR) wrote:

>(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?

Use Epilog or Prolog. For example

Plot[x, {x, 0, 1}, Epilog -> {Red, Disk[{.5, .5}, .1]},
AspectRatio -> 1]

Draws a line with a red disk on top. Or if you prefer the line
to be on top of the disk

Plot[x, {x, 0, 1}, Prolog -> {Red, Disk[{.5, .5}, .1]},
AspectRatio -> 1]


From: Sjoerd C. de Vries on
"Inset" is perfect for this application.

Cheers --Sjoerd

On Mar 7, 12:11 pm, cool-RR <ram.rac...(a)gmail.com> wrote:
> 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


From: Matthias Hunstig on
Hi,

"cool-RR" <ram.rachum(a)gmail.com> schrieb im Newsbeitrag
news:hmvu40$3ll$1(a)smc.vnet.net...
> 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.)

Take a look at the Show command.

Regards,

Matthias