Context
In a previous post, I learned how to produce these kind of plots, which are of interest in astrophysics and geophysics.
I am now interested in combining them.
Attempt
For this purpose, @belisarius suggested using the command
ImageCompose[mollwide, grid /. Line[a__] :> {White, Line[a]}]
which produces this (note the incorrect scaling)
As an other example (to make this question self contained) let us look at StreamPlot
gr = StreamPlot[{-1 - x^2 + y, 1 + x - y^2}, {x, -Pi, Pi}, {y, -Pi/2,
Pi/2}, AspectRatio -> 1/2, Frame -> False];
cart[{lambda_, phi_}] := With[{theta = fc[phi]}, {2 /Pi*lambda Cos[theta], Sin[theta]}];
fc[phi_] := Block[{theta}, If[Abs[phi] == Pi/2, phi, theta /.
FindRoot[2 theta + Sin[2 theta] == Pi Sin[phi], {theta, phi}]]];
gr2 = gr /. Arrow[pts_] :> Arrow[(cart /@ pts)] /.
Point[pts_] :> Point[cart[ pts]] //
Show[#, PlotRange -> {{-2, 2}, {-1, 1}}] &;
i = Import["http://tpfto.files.wordpress.com/2012/02/firemap.png"];
invmollweide[{x_, y_}] := With[{theta = ArcSin[y]}, {Pi (x)/(2 Cos[theta]),
ArcSin[(2 theta + Sin[2 theta])/Pi]}];
moll = ImageTransformation[i, invmollweide, DataRange -> {{-Pi, Pi}, {-Pi/2, Pi/2}},
PlotRange -> {{-2, 2}, {-1, 1}}, Padding -> White];
ImageCompose[ImageResize[moll, 1200],
gr2 /. Arrow[a__] :> {AbsoluteThickness[3], White, Arrow[a]}]
Question
- How can I make sure the image size match?
- How can I combine them so that the grid remains a vector image rather than a raster?
ImageResize[]
can be appropriately applied... – J. M.♦ Oct 21 '12 at 13:42ImageCompose[ImageResize[moll, 800], grid /. Line[a__] :> {AbsoluteThickness[2], White, Line[a]}]
produces this mollweide with grid which is better in terms of resolution, but the global scaling remains the same. – chris Oct 21 '12 at 13:47gr2 = gr /. Arrow[pts_] :> Arrow[(cart /@ pts)] /. Point[pts_] :> Point[cart[ pts]] // Show[#, PlotRange -> {{-2, 2}, {-1, 1}},PlotRangePadding -> 0]] &;
does the trick; please post your answer? – chris Oct 21 '12 at 14:17