def render_back(self): old_plot_front = self.plot_front self.plot_front = lambda: None try: Bloch.render(self) finally: self.plot_front = old_plot_front
def plot_arc_test(self, fig, *args, **kw): b = Bloch(fig=fig) b.add_arc(*args, **kw) b.render()
def plot_vector_test(self, fig, vector_kws): b = Bloch(fig=fig) for kw in vector_kws: vectors = kw.pop("vectors") b.add_vectors(vectors, **kw) b.render()
def plot_point_test(self, fig, point_kws): b = Bloch(fig=fig) for kw in point_kws: points = kw.pop("points") b.add_points(points, **kw) b.render()
def plot_line_test(self, fig, *args, **kw): b = Bloch(fig=fig) b.add_line(*args, **kw) b.render()
figure, axes = plt.subplots(figsize=(5, 5), subplot_kw=dict(projection='3d')) #axes.axis("square") bloch_sphere_3d = Bloch(fig=figure, axes=axes) bloch_sphere_3d.xlabel[0] = "$\\left|+\\right>$" bloch_sphere_3d.xlabel[1] = "$\\left|-\\right>$" bloch_sphere_3d.ylabel[0] = "$\\left|+i\\right>$" bloch_sphere_3d.ylabel[1] = "$\\left|-i\\right>$" bloch_sphere_3d.zlabel[0] = "$\\left|0\\right>$" bloch_sphere_3d.zlabel[1] = "$\\left|1\\right>$" bloch_sphere_3d.render(fig=figure, axes=axes) # render to the correct subplot # set title for the axis axes.set_title('TITLE goes here', y=1.1, fontsize=20) # You can anything else you want to the axis as well! #ax.annotate('TEXT', xy=(0.1, 0.9), xytext=(0.1, 0.7), xycoords='axes fraction', # fontsize=15, color='r', ha='center',) plt.show() """ bloch_sphere_3d = Bloch() bloch_sphere_3d.clear() bloch_sphere_3d.view[0] = -50