From: Patrick Scheibe on
Hi,

use Show

points = RandomReal[{-1, 1}, {100, 2}];
Show[{
Graphics[{Red, Line[points]}, Axes -> True],
Plot[Sin[Pi x], {x, -1, 1}, PlotStyle -> {Thick}]}]

Cheers
Patrick

On Sun, 2010-01-31 at 07:53 -0500, a boy wrote:
> points = RandomReal[{-1, 1}, {100, 2}]
> Graphics[{Red, Line[points], Plot[Sin[x], {x, -10 Pi, 10 Pi}]},
> Axes -> True]
>
> The code doesn't work. how to draw them together? ImageCompose ?
>
>


From: brien colwell on
I've used a couple approaches depending on whether you want to superimpose
graphics or embed graphics inside another graphic. If you have several
layers of graphics, you can use Show[graphic layers...] to superimpose them.
If you want to embed one graphic in another, you can use
FullGraphics[graphic] to retrieve the primitives for a graphic, which can be
embedded in another primitive list.




On Sun, Jan 31, 2010 at 7:53 AM, a boy <a.dozy.boy(a)gmail.com> wrote:

> points = RandomReal[{-1, 1}, {100, 2}]
> Graphics[{Red, Line[points], Plot[Sin[x], {x, -10 Pi, 10 Pi}]},
> Axes -> True]
>
> The code doesn't work. how to draw them together? ImageCompose ?
>
>
>


From: Bob Hanlon on

pts = Sort[{#, Sin[#]} & /@
RandomReal[{-10 Pi, 10 Pi}, {100}]];

Plot[Sin[x], {x, -10 Pi, 10 Pi},
Epilog -> {Red, Point[pts]}]

Show[Plot[Sin[x], {x, -10 Pi, 10 Pi}],
Graphics[{Red, Point[pts]}]]

Plot[Sin[x], {x, -10 Pi, 10 Pi},
Epilog -> {Red, Line[pts]}]

Show[Plot[Sin[x], {x, -10 Pi, 10 Pi}],
Graphics[{Red, Line[pts]}]]


Bob Hanlon

---- a boy <a.dozy.boy(a)gmail.com> wrote:

=============
points = RandomReal[{-1, 1}, {100, 2}]
Graphics[{Red, Line[points], Plot[Sin[x], {x, -10 Pi, 10 Pi}]},
Axes -> True]

The code doesn't work. how to draw them together? ImageCompose ?


From: Tomas Garza on
Two possibilities:

a) Plot[Sin[x],{x,-Pi,Pi},Epilog->Line[{points}]]

b) gr1=Plot[Sin[x],{x,-Pi,Pi}];
gr2=Graphics[Line[{points}]];
Show[gr1,gr2]

You should take a look at tutorial/RedrawingAndCombiningPlots in Help

Tomas

> Date: Sun, 31 Jan 2010 07:53:25 -0500
> From: a.dozy.boy(a)gmail.com
> Subject: How to combine graphics pimitives and Plot function?
> To: mathgroup(a)smc.vnet.net
>
> points = RandomReal[{-1, 1}, {100, 2}]
> Graphics[{Red, Line[points], Plot[Sin[x], {x, -10 Pi, 10 Pi}]}=
,
> Axes -> True]
>
> The code doesn't work. how to draw them together? ImageCompose ?
>
>

From: Wim W. Wilhelm on
For example:

Show[
Graphics[{Red, Line[points]}],
Plot[Sin[x], {x, -10 Pi, 10 Pi}, Axes -> True]
]


"a boy" <a.dozy.boy(a)gmail.com> wrote in message
news:hk3ug1$dr1$1(a)smc.vnet.net...
> points = RandomReal[{-1, 1}, {100, 2}]
> Graphics[{Red, Line[points], Plot[Sin[x], {x, -10 Pi, 10 Pi}]},
> Axes -> True]
>
> The code doesn't work. how to draw them together? ImageCompose ?
>
>