Skip to content

Draw some figures with changing font using python, matplotlib.pyplot

Notifications You must be signed in to change notification settings

ehki/savefig-changing-font

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

savefig_changing_font.py

How to use

Simply replace plt.savefig with savefig_changing_font as follows:

$ python
>>> import matplotlib.pyplot as plt
>>> from savefig_changing_font import savefig_changing_font as savecf
>>> x = [1,2,3,4,5]
>>> y = [1,4,9,16,25]
>>> plt.plot(x,y,"ro-")
>>> plt.xlabel("$x$ for $f(x)=x^2$ as x label")
>>> plt.ylabel("$f(x)$ as y label")
>>> plt.annotate("Sample Text1",[1.5,18])
>>> plt.annotate("Sample Text2",[1.5,15],fontname="Arial")
>>> savecf(fmt="png",dpi=200) # default fmt is "pdf"

Then you can see following three files:

image with computer modern mathtext

image with times new roman

image with arial

About

Draw some figures with changing font using python, matplotlib.pyplot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published