Artificial line exists when plot a shape with fill command

Hello,

I was trying to plot some shape with filled area with pyplot backend, for example

using Plots
pyplot()

x = [1,2,3,2,1]
y = [1,0,1,2,1]
p = plot(x,y, fill=true)
savefig(p,"tmp.eps")

It works as expected and show nicely in Jupyter notebook. But when I save it to an eps file and open the eps file, there exists an artificial line between the shape and x-axis. The problem still exists when I use latex to transfer the eps file to pdf. I have tried Adobe Reader, Adobe Acrobat, Foxit, the artificial line is there for all of them. The julia version I have is 1.0.4. Does anyone have clues on this problem? Thank you very much.

Welcome @Ruizhi_Yang to the Julia community!

It seems to be some problem with the .eps format: I tried to save it at .svg, opened it with Inkscape and saved it from there to .eps and the outcome is the same problematic lines visible in the .eps file.
Same happens with Scribus.

Gimp seems to do it better: opening .svg with Gimp, export as .eps looks good.

Looking at the .eps files: Gimp seems to produce a bitmap embedded in postscript, the other tools (and pyplot) stay with vectorlike description of the graph.

So using Gimp may be of no help for you depending on the purpose you need the .eps for.

1 Like

The solution of this thread is not so interesting here, because it is about R, but the answer after the solution is probably what happens here. It also suggests:

Use PDF only. Don't use EPS.

If you must use EPS, use a two-step process:
    Create the PDF first.
    Then convert from the (transparency-enabled) PDF to EPS, 'flattening' the transparent elements into rasterized areas which emulate the desired transparency effect.
1 Like

@oheil Thank you very much your helpful reply! I tried to save the figure as pdf in Jupyter notebook. If I open the file with Adobe series software, the problematic line still exists. But the figure is perfectly fine for Foxit or google chrome. This should be related to how different softwares interpolate the vector image. This problem is still annoying, but at least you found a workaround.

1 Like