using matplotlib and trying to get good figures in a latex document, save as an eps. Specifically, try something like this after running the commands to plot the image:
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
from matplotlib.path import Path
from matplotlib.patches import PathPatch
delta = 0.025
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2
fig, ax = plt.subplots()
im = ax.imshow(Z, interpolation='bilinear', cmap=cm.RdYlGn,
origin='lower', extent=[-3, 3, -3, 3],
vmax=abs(Z).max(), vmin=-abs(Z).max())
plt.show()
plt.savefig('destination_path.eps', format='eps', dpi=1000)
这个借口的挺好的,eps格式可以直接用在latex里面,并且是矢量图,文件小,高质量。不错。学习了
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit