matplotlib.patheffects类-Artist对象的投影效果设置

229 阅读1分钟

import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patheffects as pes

x=np.linspace(0,10,100)
y=np.sin(x)

fig,ax=plt.subplots(figsize=(8,8))
title=plt.title("y=sin(x)")
x_label=plt.xlabel("x")
y_label=plt.ylabel("sinx")

title.set_path_effects([pes.withSimplePatchShadow(offset=(1,-1))])
x_label.set_path_effects([pes.withSimplePatchShadow(offset=(1,-1))])
y_label.set_path_effects([pes.withSimplePatchShadow(offset=(1,-1))])

plt.plot(x,y)
plt.show()