Last active
August 29, 2015 14:17
-
-
Save ina111/3dee50066892a6a68500 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
reload(sys) | |
import platform | |
# デフォルトの文字コードを変更する. | |
sys.setdefaultencoding('utf-8') | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.font_manager | |
from matplotlib.font_manager import FontProperties | |
from matplotlib.backends.backend_pdf import PdfPages | |
if 'Windows' == platform.system(): | |
fp = FontProperties(fname=r'C:\WINDOWS\Fonts\MSGothic.ttf') | |
if 'Darwin' == platform.system(): # for Mac | |
font_path = '/Library/Fonts/Osaka.ttf' | |
font_prop = matplotlib.font_manager.FontProperties(fname=font_path) | |
matplotlib.rcParams['font.family'] = font_prop.get_name() | |
# pdfのフォントをTrueTypeに変更 | |
matplotlib.rcParams['pdf.fonttype'] = 42 | |
# defaultのdpi=100から変更 | |
matplotlib.rcParams['savefig.dpi'] = 300 | |
# 数式(Latex)のフォントを変更 | |
matplotlib.rcParams['mathtext.default'] = 'regular' | |
plt.close('all') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment