3
$\begingroup$
p1 = ComplexPlot3D[(z^2 + 1)/(z^2 - 1), {z, -2 - 2 I, 2 + 2 I}, 
  PlotTheme -> "Detailed"]
Export["plot.png", p1]

When I export the plot, I have redundat spaces. How to reduce the spaces as optimal? enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ Right click and using Trim Bounding Box $\endgroup$
    – cvgmt
    Oct 10, 2022 at 15:23
  • $\begingroup$ Thanks. What is the code for Trim Bounding Box instead of right click? Because I will export the figure via command Export $\endgroup$
    – RF_1
    Oct 10, 2022 at 15:41
  • 1
    $\begingroup$ better to export to pdf and not png, as quality is better. You can import pdf as graphics to Latex. And For web browsing, you can always convert pdf images to svg using free tools, which is better than png. $\endgroup$
    – Nasser
    Oct 10, 2022 at 16:31
  • $\begingroup$ In fact, I want to export it .as .eps or pdf for LaTeX. But Mathematica doesn't give good results in 3D plots to get vector format (such as .eps or .pdf) while 2D plots are good. (Or I can' t achieve) $\endgroup$
    – RF_1
    Oct 10, 2022 at 16:37

1 Answer 1

5
$\begingroup$

I tried borrowing a technique from 21031:

p2 = ComplexPlot3D[(z^2 + 1)/(z^2 - 1), {z, -2 - 2 I, 2 + 2 I}, 
  PlotTheme -> "Detailed", Method -> {"ShrinkWrap" -> True}]

but that didn't change much.

Then I tried:

p3 = ImageCrop[Rasterize[p2, ImageResolution -> 300]]
Export["C:/plot3.png", p3]

which looks ok.

enter image description here


Without Rasterizing

Using SphericalRegion->False:

p4 = ComplexPlot3D[(z^2 + 1)/(z^2 - 1), {z, -2 - 2 I, 2 + 2 I}, 
  PlotTheme -> "Detailed", SphericalRegion -> False]

Export["C:/plot.png", p4]
$\endgroup$
3
  • $\begingroup$ All right, is there a way without rasterizing the picture? $\endgroup$
    – RF_1
    Oct 11, 2022 at 11:47
  • $\begingroup$ I have updated the answer after trying many options. Hopefully this works for you. $\endgroup$
    – Syed
    Oct 11, 2022 at 12:48
  • $\begingroup$ In my case, Method -> {"ShrinkWrap" -> True} combined with ImagePadding -> None works well. $\endgroup$ Mar 20 at 15:56

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.