【发布时间】:2023-03-26 03:01:01
【问题描述】:
假设我有以下设置:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(5)
y = np.exp(x)
fig1 = plt.figure()
ax1 = fig1.add_subplot(111)
ax1.plot(x, y)
我想为情节(或子情节)添加标题。
我试过了:
> fig1.title('foo')
AttributeError: 'Figure' object has no attribute 'title'
和
> ax1.title('foo')
TypeError: 'Text' object is not callable
如何使用matplotlib的面向对象编程接口来设置这些属性?
更一般地说,我在哪里可以找到 matplotlib 中类的层次结构及其对应的方法?
【问题讨论】:
标签: python matplotlib