blankDo[name_, xmin_, xmax_, ymin_, ymax_] :=   blank[name] =    Graphics[GridLines -> {Range[xmin, xmax], Range[ymin, ymax]},     GridLinesStyle -> {{Opacity[1/2], LightGray,        Dashed}, {Opacity[1/2], LightGray, Dashed}},     PlotRange -> {{xmin - 0.2, xmax + 0.2}, {ymin - 0.2, ymax + 0.2}},      AxesStyle -> {{LightGray, Dashed}, {LightGray, Dashed}},     Frame -> True,     FrameTicks -> {Range[xmin, xmax], Range[ymin, ymax]},     ImageSize -> Full];

blankDo["elf", -13, 13, -17, 20]

Works fine on screen. enter image description here

Save it manually (right clicking) enter image description here

"Good" quality.

But if I want to use it in Export

Export["a.pdf", blankDo["elf", -13, 13, -17, 20]]
Export["a.pdf", blankDo["elf", -13, 13, -17, 20], ImageSize -> Full]

Both produced "bad" quality graphs, enter image description here

Tried ImageResolution. Did not work.

  • $\begingroup$ I would just highlight the output cell bracket, choose Save Selection As... and get a faithful PDF export that way. Using Export usually produces PDF that requires disproportionate effort to get a good look. $\endgroup$ – Jens Aug 10 '18 at 20:46
  • $\begingroup$ @Jens If it is just a couple of graphs, I wouldn't mind doing it that way. But I am hoping to Export a lot of them in batches. $\endgroup$ – Chen Stats Yu Aug 10 '18 at 20:51
  • $\begingroup$ Things seem to work better if you don't use ImageSize -> Full. Try ImageSize -> 900 and see if you like the result. $\endgroup$ – Mr.Wizard Aug 10 '18 at 21:27
  • $\begingroup$ @Mr.Wizard hmmm okay for 'this' graph, but not good for a general solution, especially when my end game is to export/save batches of these files. $\endgroup$ – Chen Stats Yu Aug 12 '18 at 2:34
  • $\begingroup$ Could you explain how using explicit ImageSize in your Export would be a problem in batch usage? It seems Export needs this information to work reasonably well. Are you also exporting graphics with a fixed ImageSize (within the Graphics itself)? Perhaps we can check each Graphics for its ImageSize value and if it is Full specify an appropriate fixed size. $\endgroup$ – Mr.Wizard Aug 12 '18 at 17:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.