1
$\begingroup$

I need to rasterize a very complicate plot and superimpose this to another plot. For example

g=Rasterize[Plot[Cos[2\[Pi]x],{x,0,1},Axes->None],Background->None,ImageResolution->100];
Plot[Sin[2 \[Pi] x], {x, 0, 1}, Background -> None,Prolog -> Inset[Graphics[g]]]

However this does not produce the right alignment/scaling. Any idea how to obtain the correct behavior?

$\endgroup$
0

1 Answer 1

2
$\begingroup$

Sorry, I've realized the trick later

g = Rasterize[
Plot[Cos[2 \[Pi] x], {x, 0, 1}, Axes -> None, 
PlotRange -> {{0, 1}, {-1, 1}}], Background -> None, 
ImageResolution -> 100];
Plot[Sin[2 \[Pi] x], {x, 0, 1}, PlotRange -> {{0, 1}, {-1, 1}}, 
Background -> None, 
Prolog -> Inset[Graphics[g], {0.5, 0}, Automatic, 1]]

Just matter to add the plot ranges and scale the inset!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.