Changing grid line thickness in 3D surface plot in Python Matplotlib

旧城冷巷雨未停 提交于 2019-12-04 15:23:46

A way to set the grid parameters in mplot3d is to update the _axinfo dictionary of the respective axis.

To set the linewidth of the grid in y direction, use e.g.

ax.yaxis._axinfo["grid"]['linewidth'] = 3.

Here is a general example:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.gca(projection='3d')
ax.set_xlabel("x"); ax.set_ylabel("y"); ax.set_zlabel("z")
print ax.xaxis._axinfo

ax.xaxis._axinfo["grid"].update({"linewidth":1, "color" : "green"})

ax.yaxis._axinfo["grid"]['linewidth'] = 3.

ax.zaxis._axinfo["grid"]['color'] = "#ee0009"
ax.zaxis._axinfo["grid"]['linestyle'] = ":"


plt.show()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!