First you need to understand a bit of matplotlib architecture (see here for a long article by the founder and current lead developer). At the bottom of the backend layer, which refers to rendering and talking to equipment. At the top of this layer there are artists who know how to draw themselves, telling the backend what to do. At the top of this layer is the pyplot state machine interface, which mimics MATLAB .
Everything that you see in the picture is represented inside as Artist , and artists may contain other artists. For example, an Axes object tracks its children artists , which are axes, ticks, ticks, labels, your lines or images, etc., and Axes objects are children of Figure . When you tell a figure to draw itself (via fig.canvas.draw() ), all child artists are drawn recursively.
One of the reverse ways of this project is that this instance of Artist can be on the same figure (and moving them between the figures is difficult), so you cannot create an AxesImage object and then reuse it.
This design also separates information about what artists know. Axes objects are aware of things such as location and cue marks and display range (what he does when he knows about the Axis object, but it gets even bigger in the weeds). Things like vmin and vmax are encapsulated in Normalize ( doc ) objects that AxesImage tracks. This means that you will need to make out how you deal with everything on your list.
I would suggest either using a factory-like pattern here or a curry-like pattern
Factory - like:
def set_up_axes(some, arguements): ''' Factory to make configured axes ( ''' fig, ax = plt.subplots(1, 1)
You can complete the entire set of kwargs to easily use them as such:
my_imshow_args = {'extent':[...], 'interpolation':'nearest', 'norm': my_norm, ...} ax2.imshow(..., **my_imshow_args)
Curry like:
def my_imshow(im, ax=None, *args, **kwargs): if ax is None: ax = plt.gca()
If you want to be super smart, you can plt.imshow monkey patch with your version
plt.imshow = my_imshow
There is also an rcParams interface that allows you to change the default values โโfor a lot of bits and parts of matplotlib in a global path.
And another way to accomplish (via partial )