画图时,全面变量的设置:
1 import matplotlib.pyplot as plt 2 import numpy as np 3 import pandas as pd 4 from pylab import mpl 5 import seaborn as sns 6 import data 7 8 mpl.rcParams['font.sans-serif'] = ['SimHei'] 9 plt.rcParams['axes.unicode_minus'] = False 10 plt.figure(facecolor='snow') 11 sns.set_style("darkgrid", {"font.sans-serif": ['simhei', 'Droid Sans Fallback','Times New Roman']}) 12 font_size = 12 13 font_family = "SimHei" 14 font_weight = "bold" 15 plt.rc("font", size=font_size, family=font_family, weight=font_weight) 16 # my_font = fm.FontProperties(fname="C:\Windows\Fonts\simhei.ttf") 17 18 font2 = {'family' : 'Times New Roman', 19 'weight' : 'bold', 20 'size' : 12, 21 } 22 23 # fig,ax=plt.subplots(figsize=(6.4,4.8), dpi=100) 24 fig,ax=plt.subplots(figsize=(6.4,4.8), dpi=100)