# GridLines make figure exported to EPS locally bitmap (?!)

Noticed strange behaviour of Export[] when saving graphics to EPS. Here is an example figure I am exporting:

fig =
Show[
ListPolarPlot[
Table[{a, .9}, {a, 0, 2 Pi, .001}],
PlotRange -> {{0, 1.1}, {0, 1.1}}, GridLines -> Automatic,
PlotStyle -> PointSize[.005]],

Graphics[
Inset[
ListPolarPlot[Table[{a, .1}, {a, 0, 2 Pi, .001}], Axes -> False,
PlotStyle -> PointSize[.05]],
{.4, .4}]
]
]


The exported figure does not look fine upon a close look --- horizontal grid lines seem to be rasterised:

If I now apply GridLinesStyle -> Thick, the problem disappears:

Any ideas why that happens? I use Mathematica for MacOS v. 11.0.1.0.

Can anyone with MMA v11 reproduce the issue?

• Not sure if this is relevant here, but anything that invokes Opacity will cause an eps to be rasterized. ( I do not know if the automatic grid style might use opacity ) – george2079 Nov 18 '16 at 17:25
• Having said that I just ran it and can not reproduce the issue. Can you open the two eps files in a text editor and compare. Even if you aren't familiar with postscript it will be obvious if you have big blocks of ascii-encoded binary raster. The file size is a clue too ( I get the same 372kb with or without GridLinesStyle -> Thick ) – george2079 Nov 18 '16 at 17:40
• @george2079 files are very close in size, though much heavier than what you get (3.4 mb). I cannot see any blocks of ascii in these files, here are the files in case you want to have a look (auto, thick). I cannot find a way check the default style for gridlines (if it has any opacity). – yuriyi Nov 19 '16 at 13:27
• your files are vastly different from mine (v10.1,windows). As near as i can tell they are rendering the lines not as postscript lines but a as filled polygons (thousands of little rectangles), and there is a small binary raster (search for "image" in the eps files) that is possibly the polygon fill pattern. Sorry I have no idea how to fix. Can you see if you have the same issue with plain ListPlot? I'd also try without using Inset to see if that is the issue. – george2079 Nov 19 '16 at 15:01
• @george2079 I do not use Joined option, hence the polygons might actually be plot points. The issue persists in both cases (plain ListPlot, no Inset). Interestingly, vertical grid lines are rendered correctly. Maybe that's v11 bug? – yuriyi Nov 19 '16 at 17:04

The default grid lines style uses uses partially transparent grid lines:

InputForm@AbsoluteOptions[fig, GridLinesStyle]
(* {GridLinesStyle -> Directive[GrayLevel[0.5, 0.4]]} *)


where the second argument of GrayLevel specifies opacity. As pointed out by george2079 in the comments, this causes the exported eps file to be partially rasterized.

Specifying GridLinesStyle -> Thick removes the default specification, fixing the problem, but changing the appearance. You can keep the original appearance with GridLinesStyle -> GrayLevel[.8]:

fig = Show[ListPolarPlot[Table[{a, .9}, {a, 0, 2 Pi, .001}],
PlotRange -> {{0, 1.1}, {0, 1.1}}, GridLinesStyle -> GrayLevel[.8],
GridLines -> Automatic, PlotStyle -> PointSize[.005]],
Graphics[Inset[ListPolarPlot[Table[{a, .1}, {a, 0, 2 Pi, .001}], Axes -> False,
PlotStyle -> PointSize[.05]], {.4, .4}]]]


First do correct exporting procedure

Export["/Users/jecalderon1/Documents/testFigreu.eps", fig, "EPS"]


Off course, you have to change the direction of the directory path../user/ to your local directory.

Then open using Adobe Illustrator . Will render the correct way.

• I use the same export procedure. An application I use to view the file does not seem to be important. – yuriyi Nov 18 '16 at 16:00