How to export eps files in python

(*-*)浩
Release: 2019-07-03 12:01:03
Original
10462 people have browsed it

Can be directly exported to .eps file using python. Command: plt.savefig("./plteps.eps", format='eps', dpi=1000)

How to export eps files in python

Example:(Recommended learning:Python video tutorial)

import matplotlib.pyplot as plt from math import sin i = [x for x in xrange(-10,10,1)] j = [x**2 for x in i] plt.plot(i, j, linewidth=2.0, color='r') # plt.show() plt.savefig('./plteps.eps', format='eps', dpi=1000)
Copy after login

Cannot open plt.show, otherwise, a valid eps file cannot be generated

Comment out show, and the eps file can be generated normally.

note:

The font of graphics cannot be set to Times New Roman, otherwise, it cannot be generated.

font = {'family' : 'Times New Roman', #'serif', 'color' : 'black', 'weight' : 'normal', 'size' : 35, }
Copy after login

Although the image in .eps format is obtained in this way, there are blank spaces around it. There are two methods to remove these blanks. One method is to use gsview. On Windows, generally Will use this tool, another method is to use epstool (http://pages.cs.wisc.edu/~ghost/gsview/epstool.htm).

For more Python related technical articles, please visit thePython Tutorialcolumn to learn!

The above is the detailed content of How to export eps files in python. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!