【发布时间】:2018-10-23 13:36:39
【问题描述】:
代码:
b=qt.Bloch(axes=a)
pnt = [px[:],py[:],pz[:]]
b.add_points(pnt)
# b.fig = plt.subplot(326)
plt.title('Bloch sphere')
此代码创建小的起始图,但它是空的。 See screenshot of the result
将 Bloch 球体显示为单独的图形效果很好。
【问题讨论】:
代码:
b=qt.Bloch(axes=a)
pnt = [px[:],py[:],pz[:]]
b.add_points(pnt)
# b.fig = plt.subplot(326)
plt.title('Bloch sphere')
此代码创建小的起始图,但它是空的。 See screenshot of the result
将 Bloch 球体显示为单独的图形效果很好。
【问题讨论】:
在 show() 之前需要渲染函数。 必须为创建 Bloch 实例和调用渲染分配参数(图和轴)。
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = subplot('211', projection='3d')
b = qt.Bloch(fig=fig, axes=ax)
b.render(fig=fig, axes=ax)
plt.show()
【讨论】: