matplotlib 一张图多个图_Matplotlib:在多个子图中嵌入图像()

我想用matplotlib生成一个多重绘图,并在每个子图的角上嵌入一个图像。在

我现在正在尝试在一系列子图的每个角落嵌入一个图像。我似乎找不到一个与我前面的例子所依赖的图形的add_axes()相似的函数。在

我怎样才能达到预期的布局?在import pylab as plt

from numpy import linspace

from matplotlib.cbook import get_sample_data

from scipy.misc import imread

xs = linspace(0, 1, 100)

def single_plot():

fig, ax = plt.subplots()

ax.plot(xs, xs**2)

fn = get_sample_data("grace_hopper.png", asfileobj=False)

image_axis = fig.add_axes([0.65, 0.70, 0.3, 0.2], anchor='NE', zorder=10)

image_axis.imshow(imread(fn))

plt.show()

plt.clf()

def multi_plot():

fig, axes = plt.subplots(4)

for axis in axes:

axis.plot(xs, xs**2)

# How to draw the same image as before in the corner of each subplot ?

plt.show()

if __name__ == '__main__':

single_plot()

multi_plot()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值