8
$\begingroup$

I'm trying to export an image at 1000 dpi. The author guide of a lot of papers wants this resolution! Then I must to import this image in Word in a small box; let's say 7x4 cm. This is the code that I made and the relative image:

grayColorList = (Blend[{Black, White}, #] & /@ Range[0, 1, 0.1]);
histogram = 
Labeled[Histogram[{dataBr[[All, 1]], datacl[[All, 1]], 
dataFCl[[All, 1]], dataF[[All, 1]]}, ChartLayout -> "Stacked", 
ChartLegends -> {"Br-derivatives", "Cl-derivatives", 
 "F+Cl+Br-derivatives", "F-derivatives"}, 
ChartStyle -> {grayColorList[[1]], grayColorList[[4]], 
 grayColorList[[7]], grayColorList[[9]]}], {Rotate[
Style["Relative Frequency", 12], 90 Degree], 
"\!\(\*SubscriptBox[\(\[Lambda]\), \(Exp\)]\)"}, {Left, Bottom}, 
FrameMargins -> {{-8, 0}, {0, 0}}] 

Image1

This is a very nice image, but when I try to Export it

Export["Histogram.Tif", histogram, ImageResolution -> 1000]

This is the result: enter image description here

And this is very ugly image! I've read the other similar posts but I can't find the answer. Thanks in advance.

$\endgroup$
2
  • 2
    $\begingroup$ You need to set a specific ImageSize for your graphics. $\endgroup$
    – rm -rf
    Commented Feb 18, 2014 at 22:05
  • $\begingroup$ If i understand this all correctly, you essentially need an image that is 2756x1575 pixels in size. $\endgroup$
    – chuy
    Commented Feb 18, 2014 at 23:05

1 Answer 1

13
$\begingroup$

This problem is essentially because the new-in-9 legending functionality does not produce Graphics objects. It produces something similar to Row (i.e. with an underlying RowBox) that joins the Graphics and the legend. This is a generic object that can be displayed in a notebook but cannot be manipulated as conveniently as Graphics objects.

This tends to break my workflow too and I can't do a number of things I could easily do with Graphics (e.g. export to a specific size) ... I wish legended graphics were still proper Graphics.

Fortunately, as rm-rf said, in this case the solution is easy: just use the ImageSize option in Histogram with a numeric argument (i.e. not Automatic). For example, use ImageSize -> 360 which is the same as the default. Now exporting at higher resolution won't change the relative size of the graphics and the legend.

$\endgroup$
1
  • $\begingroup$ Thanks a lot! very useful comment... $\endgroup$
    – Mary
    Commented Feb 19, 2014 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.