[mplot3d] remove background

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()

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

···

On Sunday, November 28, 2010, Nicolas Pinto <nicolas.pinto@...287...> 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
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

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.root@...1304...> wrote:

On Sunday, November 28, 2010, Nicolas Pinto <nicolas.pinto@...287...> 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
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

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

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 <nicolas.pinto@...287...> 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.root@...1304...> wrote:

On Sunday, November 28, 2010, Nicolas Pinto <nicolas.pinto@...287...> 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
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

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

------------------------------------------------------------------------------
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
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

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

···

On Sun, Nov 28, 2010 at 7:48 PM, Jae-Joon Lee <lee.j.joon@…2015…87…> 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 <nicolas.pinto@…287…> 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.root@…1304…> wrote:

On Sunday, November 28, 2010, Nicolas Pinto <nicolas.pinto@…287…> 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

Matplotlib-users@lists.sourceforge.net

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