I tested saving in a ‘eps’ format function using the test code
from http://www.scipy.org/Cookbook/Matplotlib/LaTeX_Examples.
The code looks like
![eps.jpg|686x425](upload://dH6ossyp6EkpOSKBM1DcHMaLHFT.jpeg)
![png.png|680x420](upload://7WCpsLNaSBybmcay5KTDIXNsrIj.png)
<details class='elided'>
<summary title='Show trimmed content'>···</summary>
#####################################################################
import pylab
from pylab import arange,pi,sin,cos,sqrt
fig_width_pt = 246.0 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27 # Convert pt to inch
golden_mean = (sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*golden_mean # height in inches
fig_size = [fig_width,fig_height]
params = {'backend': 'ps',
'axes.labelsize': 10,
'text.fontsize': 10,
'legend.fontsize': 10,
'xtick.labelsize': 8,
'ytick.labelsize': 8,
'text.usetex': True,
'figure.figsize': fig_size}
pylab.rcParams.update(params)
# Generate data
x = pylab.arange(-2*pi,2*pi,0.01)
y1 = sin(x)
y2 = cos(x)
# Plot data
pylab.figure(1)
pylab.clf()
pylab.axes([0.125,0.2,0.95-0.125,0.95-0.2])
pylab.plot(x,y1,'g:',label='$\sin(x)$')
pylab.plot(x,y2,'-b',label='$\cos(x)$')
pylab.xlabel('$x$ (radians)')
pylab.ylabel('$y$')
pylab.legend()
pylab.savefig('eps.eps')
pylab.savefig('png.png',dpi=200)
#####################################################################
After trying the above code, I found 2 problems in saving in 'eps' format.
I attached the result saved in eps format (eps.jpg) along with the result
saved in png format (png.png) to describe the problems.
1. The location of axes is not correct when the plot is saved in 'eps' format.
It seems like that the appointed axes location is ignored when any of the
component in the plot is out of the figure.
2. Although the legend label in the 'eps' file is acceptable, the legend
label in 'png' file looks better.
In addition to the above problems, I want to know whether there exists a way to
adjust the distance between a axis label and tick label. When I raised the axis
label font size to 11 or 12, the gap between a axis label and tick label becomes
too small. I may be able to put a text instead of axis label, it, however, takes too
much time for me to determine the proper text position manually everytime.
Actually I’ve asked the same question few days ago and I’ve not no answer so far.
Aren’t there any proper way to adjust the distance between a axis label and tick label?
–
Yong-Duk Jin