Changing the background color of the axes planes of a matplotlib 3D plot

后端 未结 2 1591
时光取名叫无心
时光取名叫无心 2020-12-10 01:10

On the basis of the scatterplot example of matplotlib, how can I change the gray background color of the 3 axes grid planes? I would like to set it to white, keeping the gri

2条回答
  •  臣服心动
    2020-12-10 01:39

    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 YZ
    ax.w_xaxis.set_pane_color((1.0, 1.0, 1.0, 1.0))
    plt.show()
    

提交回复
热议问题