如何用其他数据在更大的图上显示QuTiP Bloch球体作为起始图形?

2024-04-20 05:44:24 发布

您现在位置:Python中文网/ 问答频道 /正文

代码:

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 sphere显示为单独的图形效果良好。在


Tags: 代码pyadd图形figpltqtpoints
1条回答
网友
1楼 · 发布于 2024-04-20 05:44:24

Render函数在show()之前是必需的。 必须为创建Bloch实例和调用render指定参数(fig和axes)。在

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

相关问题 更多 >