Working with margins paddings and compositions of multiple figures

*To*: mathgroup at smc.vnet.net*Subject*: [mg113131] Working with margins paddings and compositions of multiple figures*From*: Vincent <sheeplane at gmail.com>*Date*: Wed, 13 Oct 2010 23:28:46 -0400 (EDT)

I currently have a problem where I want to superimpose a figure ontop of a loaded jpeg, which I've been trying to hack together using ImageCompose. But for som reason you can't set the size of the overlay, which means I have to plot the figure in such a way that the paddings and margins are just right, which meens alot of messing around with the numbers manually. Ideally It should be possible to simply specify that {20%,20%} in the overlay should be at {10%,10%} in the image, with a size such that {90%,90%} in the overlay is at {30%, 30%} in the image or something similar. Image=Import["file.jpg"]; ImageCompose[Image, Plot[Sin[x], {x, 0, 5}, Axes -> None,ImageSize -> 100, ImageMargins - > 200, AspectRatio -> 1/2 , AspectRatio -> 0.7]] In general I find it hard to see the way you "are supposed" to work with margins and paddings in Mathematica, it seems frustatingly hard to do stuff like putting two plots in a graphicsrow and making the axes lines align between them. I'm used to working in html/css where you pretty much just specify all margins and paddings and get everything lined up perfectly. I'm wondering if theres some typical way of making stuff align in mathematica which I'm just missing, or if on the lower level expressions it becomes easier to control these things.