我正在使用一些在Python中使用matplotlib单例版本的代码,即它具有如下调用:
plt.figure()
...
plt.xlabel("abc")我正在尝试将其转换为功能/无内存版本:
fig,ax = plt.subplots()
...
ax.set_xlabel("abc")有几个问题:
ax.xlabel = "xlabel string"?plt.xlabel()变为ax.set_xlabel()?发布于 2020-04-04 22:02:59
Matplotlib有Matplotlib接口,然后开发面向对象的接口,如文档(https://matplotlib.org/3.2.1/tutorials/introductory/lifecycle.html)中所描述的那样。
后者现在是首选的,所以请使用无花果,ax = plt.subplots,然后在ax上使用setter方法。
https://stackoverflow.com/questions/61035292
复制相似问题