matplotlib中的图形和坐标轴方法

8 浏览
0 Comments

matplotlib中的图形和坐标轴方法

假设我有以下的设置:

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中类的层次结构和相应的方法?

0