SourceForge logo
SourceForge logo
Menu

Re: [Matplotlib-users] [mplot3d] remove background

From: Benjamin R. <ben...@ou...> - 2010年11月30日 16:29:01
On Sun, Nov 28, 2010 at 7:48 PM, Jae-Joon Lee <lee...@gm...> wrote:
> If you want the whole background to disappear, simply call set_axis_off
> method.
>
> ax.set_axis_off()
>
> To control the visibility of each element, use something like below.
>
> for axis in ax.w_xaxis, ax.w_yaxis, ax.w_zaxis:
> for elt in axis.get_ticklines() + axis.get_ticklabels():
> elt.set_visible(False)
>
> axis.pane.set_visible(False)
> axis.gridlines.set_visible(False)
> axis.line.set_visible(False)
>
> IHTH,
>
> -JJ
>
> On Mon, Nov 29, 2010 at 9:08 AM, Nicolas Pinto <nic...@gm...>
> wrote:
> > Thanks for the quick reply Ben. Let me know how I can help.
> >
> > Regards,
> >
> > N
> >
> > On Sun, Nov 28, 2010 at 6:54 PM, Benjamin Root <ben...@ou...> wrote:
> >> On Sunday, November 28, 2010, Nicolas Pinto <nic...@gm...>
> wrote:
> >>> Dear all,
> >>>
> >>> I'm trying to get rid of the mplot3d background (in vain, see below),
> >>> how can I do this?
> >>>
> >>> Thanks for your help.
> >>>
> >>> Best,
> >>>
> >>> Nicolas
> >>>
> >>> demo:
> >>>
> >>> from mpl_toolkits.mplot3d import axes3d, axis3d
> >>> import matplotlib.pyplot as plt
> >>> import numpy as np
> >>>
> >>> fig = plt.figure()
> >>> ax = axes3d.Axes3D(fig)
> >>>
> >>> for axis in ax.w_xaxis, ax.w_yaxis, ax.w_zaxis:
> >>> for elt in axis.get_ticklines() + axis.get_ticklabels():
> >>> elt.set_visible(False)
> >>>
> >>> myAXINFO = {
> >>> 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
> >>> 'color': (0, 0, 0, 0, 0)},
> >>> 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
> >>> 'color': (0, 0, 0, 0, 0)},
> >>> 'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
> >>> 'color': (0, 0, 0, 0, 0)},
> >>> }
> >>>
> >>> ax.w_xaxis._AXINFO = myAXINFO
> >>> ax.w_yaxis._AXINFO = myAXINFO
> >>> ax.w_zaxis._AXINFO = myAXINFO
> >>>
> >>> plt.show()
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> Increase Visibility of Your 3D Game App & Earn a Chance To Win 500ドル!
> >>> Tap into the largest installed PC base & get more eyes on your game by
> >>> optimizing for Intel(R) Graphics Technology. Get started today with the
> >>> Intel(R) Software Partner Program. Five 500ドル cash prizes are up for
> grabs.
> >>> http://p.sf.net/sfu/intelisp-dev2dev
> >>> _______________________________________________
> >>> Matplotlib-users mailing list
> >>> Mat...@li...
> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>>
> >>
> >> Unfortunately, I doubt you will be able to in the current state of
> >> mplot3d's code. The background objects get remade at every change of
> >> viewing angle or change in the figure window. I am working on some
> >> refactoring, but it will be a while before I tackle the drawing
> >> behavior.
> >>
> >> Let me take a look in the next couple of days on a possible workaround
> >>
> >> Ben Root
> >>
> >
> >
> >
> > --
> > Nicolas Pinto
> > Ph.D. Candidate, Brain & Computer Sciences
> > Massachusetts Institute of Technology, USA
> > http://web.mit.edu/pinto
>
>
Indeed, Jae-Joon is correct. I now see why Nicolas's code did not work.
The assignment of _AXINFO occurred after the initial creation of the axes
panels. While the code does reuse the _AXINFO data for some things in later
redraws, it does not re-use the color information. I should also point out
that changing the _AXINFO data has the side affect of being applicable to
all future instantiations of 3D axes within that process run. That could be
a bug or a feature, but it is something to be aware of in the future.
Ben Root

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /