10

I am trying to export a plot as an image. My actual plot uses Show to combine a ListPlot and several Plots, with a common legend. The code below is a dummy version that produces the same problem:

Labeled[Legended[
Show[Plot[t/25, {t, 10, 50}, PlotRange -> {{10, 45}, {0.4, 1.7}}, 
PlotStyle -> {{Red}}, LabelStyle -> "Text", Frame -> True, 
ImageSize -> {800, 500}]], 
Placed[PointLegend[{Red}, {"Model"}, LegendMarkers -> {None}, 
Joined -> True, LegendFunction -> "Frame"], {0.75, 
0.25}]], {Style["Long-ish title to illustrate the point", 
"Subsection"], Style["Y axis Label", "Subsubsection"], 
Style["X axis label", "Subsubsection"]}, {Top, Left, Bottom}, 
RotateLabel -> True, ImageMargins -> 5]

It renders just fine within the Mathematica notebook, but when I export it:

Export["test.png",%,ImageResolution->300]

The top label starts word-wrapping for some reason, but only in the exported file:

example of the problem

I have tried disabling word wrap in the Format menu, searched for options on text-wrap, changing to a different export format, etc.

What causes the export rendering to be different than the notebook?

cjdrover
  • 341
  • 1
  • 8

1 Answers1

8

What's the line about finding something as soon as you buy a replacement? Is there an equivalent for StackExchange questions?

This did the trick:

Export["test.png", %, ImageResolution -> 300, 
ImageFormattingWidth -> \[Infinity]]
cjdrover
  • 341
  • 1
  • 8
  • Well, there's always the online forum standard, "The power of posting." – march Oct 30 '15 at 17:14
  • I'm new to this forum and I don't know how I can comment on your answer. Feel free to delete this comment but I would really appreciate your help. Do you by any chance know how to extend your solution when exporting to all other formats, particularly the .eps and .pdf formats? Your solution works fine for .png, but I really need to export with .eps and .pdf. I am using Labeled like you in my plot, then I am trying to export but the text keeps wrapping. Thanks for your time. –  Jul 05 '16 at 14:23
  • @ccam0062 I haven't been able to replicate this problem using a PDF export with my test. Do you have a code snippet demonstrating the problem? – cjdrover Jul 06 '16 at 20:06