[Matplotlib-users] Style axes for imshow only

Thomas Caswell tcaswell at gmail.com
Mon Nov 7 21:19:32 EST 2016


No, `Axes` do not know a head of time what type of artists they will host
(which is both a feature and a bug depending on who you ask).

`imshow` _does_ change some `Axes` properties (in addition to adding the
requisite artists) such as setting the aspect ratio.   In principle we
could have an `image.axis.top` and friends rcParams, but then we maybe
should have them for _all_ of the 'basic' plotting methods.  Not only would
this lead to a great explosion of rcParams, we would also have to deal with
conflicts / rules about how to settle conflicts (which sounds like a big
mess to me).

I suggest writting a helper function like:

def my_imshow_that_changes_axis_visibilty(ax, data, **kwargs):
     # set axis visibility as you desire
     return ax.imshow(data, **kwargs)

or

def set_up_axes_axis_the_way_i_like_for_imshow(ax):
    # set up the axis the way you want


Tom

On Mon, Nov 7, 2016 at 8:40 PM Juan Nunez-Iglesias <jni.soma at gmail.com>
wrote:

> Is there a way to set different axis style for imshow plots using a style
> file?
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20161108/2a5137f7/attachment-0001.html>


More information about the Matplotlib-users mailing list