【问题标题】:How to show QuTiP Bloch sphere as onset figure on the bigger plot with other data?如何将 QuTiP Bloch 球体显示为具有其他数据的较大图上的起始图?
【发布时间】: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 球体显示为单独的图形效果很好。

【问题讨论】:

    标签: python qutip


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2021-03-09
      • 2020-05-10
      • 2014-11-11
      • 2019-05-28
      • 2021-07-11
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      相关资源
      最近更新 更多