1
$\begingroup$

Consider this simple 3d figure:

plot = Plot3D[100,
  {x, 0, 3}, {y, 0, .4},
  PlotRange -> {{0, 3}, {0, .4}, {0, 100}},
  BoxRatios -> {3, .4, .5},
  ViewPoint -> {0, -Pi, 1.3},
  ImageSize -> {710, 220},
  AxesStyle -> Thick,
  BoxStyle -> Thick,
  Mesh -> None
  ]

Exporting it with "native" resolution results in a homogeneous thickness of all box lines:

Export["test.png", plot];

enter image description here

However, when increasing the image resolution, the axis thickness scales properly by the box lines don't:

Export["test.png", plot, ImageResolution -> 200];

enter image description here

The known ticks issue seems related but not the same. Also, exporting to PDF is often not an option for 3d graphics because the files are huge. Any workaround for this?

Update:

I just realized that the problem is not directly related to export. When I increase the magnification of my notebook to, say, 300%, the same effect occurs.

$\endgroup$

1 Answer 1

1
$\begingroup$

This is another Magnify problem like (138978), as you observe. I think the lesson from this, unhappy as it may be, is not to expect ImageResolution to work properly. Instead craft your graphics (or other output) directly at the resolution that you want.

I mean something like this:

plot =
 Plot3D[100, {x, 0, 3}, {y, 0, .4}
  , PlotRange -> {{0, 3}, {0, .4}, {0, 100}}
  , BoxRatios -> {3, .4, .5}
  , ViewPoint -> {0, -Pi, 1.3}
  , AxesStyle -> AbsoluteThickness[5]
  , BoxStyle -> AbsoluteThickness[5]
  , Mesh -> None
  , TicksStyle -> Directive[FontSize -> 24]
  , ImageSize -> 3 {710, 220}
 ]

Export["test.png", plot];

It may be possible in some (many?) cases to still take advantage of automatic scaling using things like Thickness in place of AbsoluteThickness, and Scaled. The use of a Scaled FontSize does not seem to be universal however so be prepared for problems of its own if you use this. Exampe:

plot2 =
 Plot3D[100, {x, 0, 3}, {y, 0, .4}
  , PlotRange -> {{0, 3}, {0, .4}, {0, 100}}
  , BoxRatios -> {3, .4, .5}
  , ViewPoint -> {0, -Pi, 1.3}
  , AxesStyle -> Thickness[0.002]
  , BoxStyle -> Thickness[0.002]
  , Mesh -> None
  , BaseStyle -> {FontSize -> Scaled[0.02]}
  , ImageSize -> {710, 220}
 ];

You can Show or Export this object at different ImageSize specifications and have it scale fairly accurately:

Show[plot2, ImageSize -> 400]
Show[plot2, ImageSize -> 1800]

enter image description here

$\endgroup$
3
  • $\begingroup$ I'm happy that there is at least a general workaround. $\endgroup$
    – Felix
    Commented Mar 5, 2017 at 23:13
  • $\begingroup$ @Felix See my update; maybe it will be of use to you, or maybe it will cause its own problems and bring you back to exact specification as in my first example. $\endgroup$
    – Mr.Wizard
    Commented Mar 5, 2017 at 23:19
  • $\begingroup$ Thanks for this update. Personally, I will try to avoid magnification in this case, as you originally suggested. But I'm sure that there are use cases for the other approach. $\endgroup$
    – Felix
    Commented Mar 5, 2017 at 23:53

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.