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
|