You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
521 B
Python

import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
myfont = fm.FontProperties(fname='/usr/lib/python3.10/site-packages/matplotlib/mpl-data/fonts/ttf/wqy-zenhei.ttc')
def create_hist2d(dist1, dist2, title, xlabel, ylabel, fig=(5, 5)):
fig, ax = plt.subplots(figsize=fig, tight_layout=True)
ax.set_title(title, fontproperties=myfont)
ax.set_xlabel(xlabel, fontproperties=myfont)
ax.set_ylabel(ylabel, fontproperties=myfont)
hist2d = ax.hist2d(dist1, dist2, bins=20)
plt.show()