Changing the background color of the axes planes of a matplotlib 3D plot
Using the same example. You can set the pane color using the set_pane_color
method as described here http://matplotlib.org/mpl_toolkits/mplot3d/api.html#axis3d. You can set the color using the RGBA tuple:
# scatter3d_demo.py# ...# Set the background color of the pane YZax.w_xaxis.set_pane_color((1.0, 1.0, 1.0, 1.0))plt.show()
For a slightly different approach, see below:
# Get rid of colored axes planes# First remove fillax.xaxis.pane.fill = Falseax.yaxis.pane.fill = Falseax.zaxis.pane.fill = False# Now set color to white (or whatever is "invisible")ax.xaxis.pane.set_edgecolor('w')ax.yaxis.pane.set_edgecolor('w')ax.zaxis.pane.set_edgecolor('w')# Bonus: To get rid of the grid as well:ax.grid(False)
See this blog post that I used as my source.