我有一组离散的密度,例如n(i,j),我想绘制它的3d条形可视化。我的目标是通过以下链接获得一些数字:
http://qutip.blogspot.de/2012/07/quantum-process-tomography.html
http://qutip.org/docs/2.2.0/guide/guide-visualization.html#visualizing-operators
我想直接使用Matlab,matploblib或gnuplot而不是使用qutip工具箱,特别是因为qutip安装不是很简单。
任何帮助都是适当的。
在matplotlib中,您可以使用bar3d。请参阅图库中的示例,尽管您需要color
适当地设置参数以使每个栏获得不同的颜色-请参阅API文档。
编辑
给出注释后,以下代码将产生输出,而无需任何对直方图的引用:
x = np.array(range(0, 6), float) # I assume that np.loadtxt will give you (from the
y = x.copy() # comment) x,y as a 1d array in the form that this
xpos, ypos = np.meshgrid(x, y) # script would after the xpos.flatten() lines.
z = np.random.rand(6, 6) #
colors = ['b', 'g', 'y', 'r', 'k', 'c']*6 # This colors the bars individually
xpos = xpos.flatten()
ypos = ypos.flatten()
zpos = np.zeros_like(xpos)
dx = 0.5 * np.ones_like(zpos)
dy = dx.copy()
dz = z.flatten() # This is the actual data.
fig = plt.figure()
ax = fig.add_subplot(111,projection = '3d')
ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color=colors)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句