There's a bad meme here.  Hope you'll forgive the distraction!

import matplotlib.pyplot as plt
import numpy as np

def main():
    t = np.linspace(0, 4*np.pi, 1000)
    fig, ax = plt.subplots()
    ax.plot(t, np.cos(t))
    ax.plot(t, np.sin(t))

    for _ in range(10):
        fig = inception(fig)

    plt.show()

def fig2rgb_array(fig):
    fig.canvas.draw()
    buf = fig.canvas.tostring_rgb()
    ncols, nrows = fig.canvas.get_width_height()
    return np.fromstring(buf, dtype=np.uint8).reshape(nrows, ncols, 3)

def inception(fig):
    fig.tight_layout()
    fig.set_facecolor('white')
    data = fig2rgb_array(fig)
    fig.clf()
    fig.add_subplot(111).imshow(data)
    return fig

main()


[image: Inline image 1]
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to