How to turn off all clipping?

Matplotlib Folks,

How do I turn off all clipping when making a plot? It seems
like everything has a set_clip_on argument, but I couldn’t figure out how
to set all of these to False without explicitly doing so in every plot call. I
would assume that there is a way to do this using an rcParam or the
matplotlibrc file?

Any help would be appreciated!

Thanks,

Sara

···

Sara Jean Hatch

Inner Planet Mission Analysis Group

Guidance, Navigation, & Control Section

NASA - Jet Propulsion Laboratory

4800 Oak Grove Drive

M/S: 301-150

Pasadena, CA 91109

Phone: (818) 354-8723


Hatch, Sara J wrote:

Matplotlib Folks,

How do I turn off all clipping when making a plot? It seems like everything has a set_clip_on argument, but I couldn’t figure out how to set all of these to False without explicitly doing so in every plot call. I would assume that there is a way to do this using an rcParam or the matplotlibrc file?

No there isn't, and I think this is the first time this question has come up. Usually some clipping is desired. I doubt the need for absolutely no clipping is common enough to justify an rcParam entry. If you think there is a common use case that should be supported, though, please elaborate.

Every artist has a set_clip_on() method, so to turn off all clipping you are stuck having to find all the artists and turn off clipping on each individually. Maybe something like this (untested):

def noclip(ax):
     "Turn off all clipping in axes ax; call immediately before drawing"
     ax.set_clip_on(False)
     artists =
     artists.extend(ax.collections)
     artists.extend(ax.patches)
     artists.extend(ax.lines)
     artists.extend(ax.texts)
     artists.extend(ax.artists)
     for a in artists:
         a.set_clip_on(False)

I suspect this will not necessarily take care of everything; there may be compound artists that do not define their own set_clip_on method to propagate down to the sub-artists.

Eric

Or even better::

for o in fig.findobj():
o.set_clip_on(False)

findobj is an artist method that recursive searches all the artists contained in it – you can optionally specify the type of artist you want returned. See

http://matplotlib.sourceforge.net/examples/pylab_examples/findobj_demo.html

JDH

···

On Thu, Mar 19, 2009 at 2:33 PM, Eric Firing <efiring@…83…202…> wrote:

def noclip(ax):

 "Turn off all clipping in axes ax; call immediately before drawing"

 ax.set_clip_on(False)

 artists = []