python - matplotlib的3d画图怎么去掉背景的网格?
本文介绍了python - matplotlib的3d画图怎么去掉背景的网格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
import random
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from mpl_toolkits.mplot3d import Axes3D
mpl.rcParams['font.size'] = 10
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
for z in [2011, 2012, 2013, 2014]:
xs = xrange(1,13)
ys = 1000 * np.random.rand(12)
color =plt.cm.Set2(random.choice(xrange(plt.cm.Set2.N)))
ax.bar(xs, ys, zs=z, zdir='y', color=color, alpha=0.8)
ax.xaxis.set_major_locator(mpl.ticker.FixedLocator(xs))
ax.yaxis.set_major_locator(mpl.ticker.FixedLocator(ys))
ax.set_xlabel('Month')
ax.set_ylabel('Year')
ax.set_zlabel('Sales Net [usd]')
plt.show()
作者:出版圈郭志敏
链接:http://www.jianshu.com/p/bb8b...
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
解决方案
To turn the grid on and off
ax.grid(True)
ax.grid(False)
这篇关于python - matplotlib的3d画图怎么去掉背景的网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文