Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
You need to set a specific ImageSize for your graphics. –  rm -rf Feb 18 at 22:05
    
If i understand this all correctly, you essentially need an image that is 2756x1575 pixels in size. –  chuy Feb 18 at 23:05
add comment

1 Answer 1

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.

share|improve this answer
    
Thanks a lot! very useful comment... –  Mary Feb 19 at 16:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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