1

I am tring to export the plotted graphics as PNG, but its range is not coming properly:

   linearFrameTicks = {
   {Most /@ Charting`ScaledTicks[{Identity, Identity}][##] &, 
   Most /@ Charting`ScaledFrameTicks[{Identity, Identity}][##] &}, 
   {Most /@ Charting`ScaledTicks[{Identity, Identity}][##] &, 
    Most /@ Charting`ScaledFrameTicks[{Identity, Identity}][##] &}};

px = Plot[Sin[x], {x, -15, 15}, Frame -> True, ImagePadding -> {{30, 15}, {0, 10}}, ImageSize -> 300, FrameStyle -> Thickness[.003], FrameTicksStyle -> Directive[Black, FontSize -> Scaled[.015], Thickness[.003]], FrameTicks -> linearFrameTicks, PlotRange -> {{-10, 10}, All}];

py = Plot[Sin[2 x], {x, -15, 15}, Frame -> True, ImagePadding -> {{30, 15}, {20, 0}}, ImageSize -> 300, FrameStyle -> Thickness[.003], FrameTicksStyle -> Directive[Black, FontSize -> Scaled[.015], Thickness[.003]], FrameTicks -> linearFrameTicks, PlotRange -> {{-10, 10}, All}];

pz = Column[{px, py}, Spacings -> 0]

Export["pz.png", Import[ Export["pz.pdf", pz, ImageSize -> 290, ImageResolution -> 1000 ] ], ImageResolution -> 1000 ]; SystemOpen["pz.png"]

plot

Gopal Verma
  • 1,055
  • 7
  • 11
  • Care to explain why you export as PDF, reimport, then export to PNG? Also, what EXACTLY would you like in your output? Your markings on the image are not clear to me. – MarcoB Dec 01 '20 at 07:06
  • @MarcoB, I want to png image of the plot, If I exported as a png directly then frame ticks not visible. (https://mathematica.stackexchange.com/questions/51367/export-high-resolution-figure-causes-missing-ticks) I marked graphics due to it is coming outside the frame, that I don,t need. – Gopal Verma Dec 01 '20 at 07:19
  • What is the code about linearFrameTicks? – cvgmt Dec 01 '20 at 08:24
  • @cvgmt, I defined linearFrameTicks? in updated code. – Gopal Verma Dec 01 '20 at 08:42
  • @GopalVerma Exporting and then reimporting the graphic as PDF is the problem. If you want a PNG, just export it as a PNG. It is more efficient that way. – ihojnicki Dec 01 '20 at 13:35
  • @ihojnicki, then frame tick in exported png image is not clearly visible. – Gopal Verma Dec 02 '20 at 01:21
  • @GopalVerma which version are you using? The ticks looked fine to me in 12.1.1. – ihojnicki Dec 02 '20 at 03:13
  • @ihojnicki , I am using Mathematica 12. – Gopal Verma Dec 02 '20 at 03:20
  • @GopalVerma, ah. In earlier versions, on Windows at least, you could just do Export["pz.png", Style[pz, {"FontProperties" -> {"ScreenResolution" -> 1000}}], ImageResolution -> 1000]. For the other platforms unfortunately, it would need 12.1. – ihojnicki Dec 03 '20 at 14:08
  • @ ihojnicki , Thanks for your effort. – Gopal Verma Dec 04 '20 at 06:29

0 Answers0