Source

hack2 / embed / embed / matplotwrapper.py

Full commit
#!/usr/bin/env pypy

# numpy, pypy version
import numpypy as numpy
# DRAGONS LIVE THERE (fortunately hidden)
from embed.emb import import_mod

# import mattplotlib.pylab in the embedded CPython
pylab = import_mod('matplotlib.pylab')

if __name__ == '__main__':
    # normal numpy code. Arrays are passed to embedded CPython which runs
    # matplotlib *without copying*, because it's all in the same process
    a = numpy.arange(100, dtype=int)
    b = numpy.sin(a)
    pylab.plot(a, b)
    pylab.show()