Exporting a row of graphics objects broken in MMA8
Asked Answered
C

2

6

How do you make Mathematica export a Row of graphics. I do not like how GraphicsRow handles the graphics, all the aspect ratios and paddings in the figures get messed up. What I like to do is work with each individual figure and then use a simple Row,Column or Grid to combine my figures. Take the following for instance:

g1 = Plot[Sin[x], {x, -Pi, Pi}, 
      Frame -> True, FrameLabel -> {"x", "y"}, ImageSize -> 2.6*72
    ]

This creates the Sin plot. What I want to do now is create the following Figure:

Fig = Row[{g1, g1, g1}]

output

Then you can use Export

Export["TestFig.pdf", Fig]

This is the pdf I obtain in MMA8:

output

I just tried this code in MMA7 and it works fine. It had been a while since I wanted to create this type of figures and I never bothered to check if it worked in MMA8. Does any one have a fix for this in MMA8?

The desired output is the one I obtained in MMA7:

desired Output

Cervin answered 15/9, 2011 at 21:31 Comment(1)
Row automatically wraps at a certain line width. If you use Grid or GraphicsRow or GraphicsGrid, etc... then you won't have this problem.Personality
B
7

It is worth bearing in mind that GraphicsGrid assumes equal-width columns so using Grid is sometimes more useful. The same syntax as in belisarius' answer applies. It might be worth exploring the ImageSize option to Export (see documentation and tutorial).

Also, note the exporting in PDF format uses the PrintingStyleEnvironment, which is not how things look on screen. You might get better results if you change your page setup in Printing Settings.

Bureau answered 15/9, 2011 at 23:8 Comment(1)
Good note about the printing enviroment: SetOptions[$FrontEnd, PrintingStyleEnvironment -> "Working"] exports things the way they look on screen. Thank you, Grid gives me the same results in MM8 as in MM7.Cervin
W
4
Export["c:\\TestFig.pdf", GraphicsGrid[{{g1, g1, g1}}]]

enter image description here

Worm answered 15/9, 2011 at 22:3 Comment(2)
GraphicsGrid does export the figure in the intended way but notice how there's spacing from one figure to another. Somehow I can never get my graphs to expand the way they should when I use GraphicsGrid, GraphicsRow or GraphicsColumn. In any case, the comment that simon wrote solves the problem. If I use Grid in MM8 then I get the same output as in MM7.Cervin
@Cervin Good to know you solved the problem. I haven't noticed the difference between your desired output and mine until now. SorryWorm

© 2022 - 2024 — McMap. All rights reserved.