Question

I need to output my plots in EPS with the CMYK color space. Unfortunately this particular format is requested by the journal I am submitting my work to!

This discussion was the only one I could find that has addressed the issue but it is more than 2 years old. I was hoping there might be some updates fixing the problem by now.

All my programming is in Python3 and so far I have been saving my plots in PDF which had no problem. But now that I want to plot EPS there is a problem. For example the code bellow prints the simple plot in .png and .pdf but the .eps output is totally blank!

import numpy as np
import matplotlib.pyplot as plt

X=[1,2,3]
Y=[4,5,6]

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(X,Y)

fig.savefig('test.eps')
fig.savefig('test.pdf')
fig.savefig('test.png')

So I have two questions:

  1. How can I fix the eps output?

  2. How can I set the eps output color space to CMYK?

Thanks in advance.

Was it helpful?

Solution

I too have the same problem. One workaround I have found is to save plots as .svg and then use a program like Inkscape to convert to eps. I used to be able to save in .eps without any issues and then lost the ability after an update.

Update I was able to solve this problem for my specific setup by changing a few lines in my .matplotlibrc, so I will post the relevant lines here in the hope that it may be helpful to you as well. Note this requires that you have xpdf and ghostscript already installed.

For me the important one was

##Saving Figures
ps.usedistiller : xpdf

But I also have

path.simplify : True 
savefig.format : eps

Now I am able to save directly to .eps and include them in LaTeX'ed journal articles...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top