Re: How to combine graphics pimitives and Plot function?
- To: mathgroup at smc.vnet.net
- Subject: [mg107061] Re: How to combine graphics pimitives and Plot function?
- From: Fred Klingener <gigabitbucket at BrockEng.com>
- Date: Tue, 2 Feb 2010 03:24:56 -0500 (EST)
- References: <hk3ug1$dr1$1@smc.vnet.net>
On Jan 31, 7:53 am, a boy <a.dozy.... at 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 ?
Others have given you the most direct approaches, but if you have
special ambitions (or if the inscrutable rules Mathematica uses to
compose such things is driving you flat crazy) and you want to get
close to the bone, start by looking at (ps=Plot[Sin[x],{x,-Pi, Pi}])//
FullForm, say.
You'll see that the bare list of the geometric primitives for the
curve is available as ps[[1, 1, 3, 2]], so you can compose a Graphics
with any structure you want. Like a fanciful
Graphics[{
{Red, Line[points]}
, {Blue
, Thick
, Rotate[ps[[1, 1, 3, 2]], Pi/6.]}
}
, Axes -> True
]
Hth,
Fred Klingener