Numpy Inheritance; add a method to Numpy Array

Viewed 461

Let's say we have a 2D array, image, eg. 20x20. I would like add a method, called 'imshow' to this object such that whenever I do image.imshow(**kwargs)), the method imshow will make a call of Matplotlib.pyplot.imshow

What is the best way to do this? I was thinking of writing a class with an inheritance from numpy.ndarray, and adding a method 'imshow'.

1 Answers
Related