with plt.xkcd(): fig, ax = plt.subplots(figsize=(6.5,4),dpi=100) ax = df.plot.kde(color=["#BC3C28","#0972B5"],ax=ax) ax.set_ylim((0, 0.4)) ax.legend(frameon=False) ax.set_title("EXAMPLE02 OF MATPLOTLIB.XKCD()",pad=20) ax.text(.8,-.22,'Visualization by DataCharm',transform = ax.transAxes, ha='center', va='center',fontsize = 10,color='black')
样例三:
with plt.xkcd(): fig, ax = plt.subplots(figsize=(6.5,4),dpi=100) ax.spines["right"].set_color('none') ax.spines["top"].set_color('none') ax.set_xticks([]) ax.set_yticks([]) ax.set_ylim([-30, 10]) data = np.ones(100) data[70:] -= np.arange(30) ax.annotate( 'THE DAY I REALIZED\nI COULD COOK BACON\nWHENEVER I WANTED', xy=(70, 1), arrowprops=dict(arrowstyle='->'), xytext=(15, -10))
ax.plot(data,color="#BC3C28")
ax.set_xlabel('time') ax.set_ylabel('my overall health') ax.set_title("EXAMPLE03 OF MATPLOTLIB.XKCD()") ax.text(.8,-.15,'Visualization by DataCharm',transform = ax.transAxes, ha='center', va='center',fontsize = 10,color=
'black')