前提・実現したいこと
Python初心者です.
rcParamsで文字の書式をTimes new roman に設定したのに凡例にしか適用されません.
初歩的な質問だとは思うのですが,ご教授お願いします.
該当のソースコード
Python
1matplotlib.rcParams['font.family'] = 'Times New Roman' 2matplotlib.rcParams['mathtext.default'] = 'regular' 3matplotlib.rcParams['xtick.top'] = 'True' 4matplotlib.rcParams['ytick.right'] = 'True' 5matplotlib.rcParams['xtick.direction'] = 'in' 6matplotlib.rcParams['ytick.direction'] = 'in' 7matplotlib.rcParams['axes.xmargin'] = '0' #'.05' 8matplotlib.rcParams['axes.ymargin'] = '.05' 9matplotlib.rcParams['savefig.facecolor'] = 'None' 10matplotlib.rcParams['savefig.edgecolor'] = 'None' 11matplotlib.rcParams['savefig.bbox'] = 'tight' 12matplotlib.rcParams['font.size'] = 16 13matplotlib.rcParams['axes.grid'] = 'False' 14 15w = 2 16p1 = ax1.bar(x + w/2, car, label = 'car', alpha = 0.5, color = 'blue', align = 'center', width = w) 17p2 = ax1.bar(x - w/2, ped, label = 'pedestrian', alpha = 0.5, color = 'green', align = 'center', width = w) 18 19p3 = ax2.scatter(x , y_car, label = 'car accumulation', marker = 'o', color = 'blue', 20 alpha = 0.8, facecolors = 'none', edgecolor = 'blue', linewidth = 1.5 ) 21p4 = ax2.scatter(x , y_ped, label = 'ped accumulation', marker = 'o', facecolors = 'none', color = 'green', 22 alpha = 0.8, edgecolor = 'green', linewidth = 1.5 ) 23 24p5 = ax2.plot(x, y_car_pred, linestyle="--", label="car fitting (${R^2}$=0.997)", color = 'blue', alpha = 0.7) 25p6 = ax2.plot(x, y_ped_pred, linestyle="--", label="ped fitting (${R^2}$=0.996)", color = 'green' , alpha = 0.7) 26 27ax1.set_xlabel('start time(min)',fontsize=18) 28ax1.set_ylabel('number of people',fontsize=18) 29ax2.set_ylabel('F(x)',fontsize=18) 30ax1.tick_params(labelsize = 16) 31ax2.tick_params(labelsize = 16) 32 33 34p = [p1, p3, p5[0], p2, p4, p6[0]] 35ax1.legend(p, [i.get_label() for i in p], loc ='center right',edgecolor = 'black')

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。