在 matplotlib 图中保存一个角图

Save a corner plot in matplotlib figure

我有一个简单的角图。让我们想象一下他们页面上的示例(取自 here):

import corner
import numpy as np

ndim, nsamples = 2, 10000
np.random.seed(42)
samples = np.random.randn(ndim * nsamples).reshape([nsamples, ndim])
figure = corner.corner(samples)

现在我想问一下,我能否将完整的 canvas(共 3 个图)保存在单个 matplotlib 图中,以便我可以将此图插入另一个更大的 matplotlib 图中。

另外我还有一个问题,有没有办法把自定义 legend/title 放在角地块上?

这是我在 Stack Overflow 上的第一个 post,声誉不到 50 我无法 post 将此作为评论,希望它能在一定程度上有所帮助。

使用此行保存角图的图形:

corner.corner.savefig('cornerplot...')

也许这是可调的,可以作为 matplotlib 子图对象重新加载。虽然了解源代码肯定是最好的