投稿

1月, 2020の投稿を表示しています

Matplotlibのテンプレ

論文用 Import部分 import pandas as pd import numpy as np import matplotlib.pyplot as plt fs = 10 plt.style.use( "tableau-colorblind10" ) plt.rcParams[ "font.size" ] = fs plt.rcParams[ "axes.titlesize" ] = plt.rcParams[ "font.size" ] plt.rcParams[ "lines.linewidth" ] = 2.5 plt.rcParams[ "legend.handlelength" ] = 1.5 plt.rcParams[ "legend.frameon" ] = False def cm2inch(x,y): return [x / 2.54 , y / 2.54 ] プロットするところ labels = [ "Alice" , "Bob" , "Carol" ] m = len (labels) markers = [ None ] * m lw = plt.rcParams[ "lines.linewidth" ] lws = [lw] * m lss = [ "-" ] * m params = [{ "label" : labels[i], "marker" : markers[i], "lw" : lws[i], "ls" : ls[i], } for i in range (m)] for i in range (m): ax.plot(x, y[i], ** params[i]) ax.legend() ...