更改 matplotlib 3D 图的轴平面的背景颜色 [英] Changing the background color of the axes planes of a matplotlib 3D plot

查看:60
本文介绍了更改 matplotlib 3D 图的轴平面的背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于matplotlib的散点图示例,如何更改 3 轴网格平面的灰色背景颜色?我想将它设置为白色,保持网格线为默认的灰色.我发现了 这个问题 但我无法将其应用于示例.谢谢.

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 grid lines with the default gray color. I found this question but I couldn't apply it to the example. Thanks.

推荐答案

使用相同的示例.您可以使用此处描述的 set_pane_color 方法设置窗格颜色 http://matplotlib.org/mpl_toolkits/mplot3d/api.html#axis3d.您可以使用 RGBA 元组设置颜色:

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

这篇关于更改 matplotlib 3D 图的轴平面的背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆