Skip to content

Instantly share code, notes, and snippets.

@ina111
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ina111/3dee50066892a6a68500 to your computer and use it in GitHub Desktop.
Save ina111/3dee50066892a6a68500 to your computer and use it in GitHub Desktop.
# -*- 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