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

后端 未结 2 1587
时光取名叫无心
时光取名叫无心 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

    For a slightly different approach, see below:

    # Get rid of colored axes planes
    # First remove fill
    ax.xaxis.pane.fill = False
    ax.yaxis.pane.fill = False
    ax.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.

提交回复
热议问题