I'm generating graphs with descriptions for upload to a website that only accepts raster image files. I can produce what I'm looking for in Mathematica 12.0's font-end using either Labeled
or Column
, but when I export the results as high-resolution raster images, a lot of white space is included around the descriptions.
Here are some examples:
Labeled
Framed@Labeled[
Plot[{Sin[x], Cos[x]}, {x, 0, 6 \[Pi]}, PlotTheme -> "Detailed",
ImageSize -> Large, LabelStyle -> Directive[Black, Larger],
PlotLabel -> "Descriptive Plot Title",
PlotLegends -> {"First Function Description",
"Second Function Description"},
FrameLabel -> {None, "Verical Axis Label"}],
"label label label label label label label label label label label
label label label label label label label label label label label
label label label label label label label label label label label
label label label label label label label label label label label
label label label label label label label label label label label
label label label"]
produces this in the front-end:
But
Export["test_lbl.png", %, ImageResolution -> 300]
generates this instead:
Similarly, Column
Column[{Plot[{Sin[x], Cos[x]}, {x, 0, 6 \[Pi]},
PlotTheme -> "Detailed", ImageSize -> Large,
LabelStyle -> Directive[Black, Larger],
PlotLabel -> "Descriptive Plot Title",
PlotLegends -> {"First Function Description",
"Second Function Description"},
FrameLabel -> {None, "Verical Axis Label"}],
"label label label label label label label label label label label
label label label label label label label label label label label
label label label label label label label label label label label
label label label label label label label label label label label
label label label label label label label label label label label
label label label"}, Frame -> All]
produces this in the front end:
but
Export["test_col.png", %, ImageResolution -> 300]
generates this instead:
Exporting as PDFs gives what I'm looking for, and of course, I can crop the PNGs, but I prefer not having to do any post-processing after exporting. So, can anyone tell me how to get Export
to reproduce what I'm seeing in the front-end?
Thanks in advance!