6
$\begingroup$

I'm trying to plot 2 vectors on the same Bloch sphere. From the qiskit documentation here, we can find plot_bloch_vector(bloch, title='', ax=None, figsize=None, coord_type='cartesian'). So I'm not quite sure if we could plot 2 vectors (say [0,0,1] and [0,1,0]) on the same Bloch sphere.

Also, from the default visualization angle, some vectors might look like they're overlapping with the x-axis (e.g the figure below). Can I switch to another angle to visualize the sphere?

enter image description here

Thanks for the help:)

$\endgroup$

1 Answer 1

5
$\begingroup$

If you are on a Jupyter notebook, you can use kaleidoscope for that. It has a block_sphere function that does exactly that. See the documentation for more info. To install it pip install kaleidoscope.

You can set several vectors in the sphere that can be rotated with the mouse.

from kaleidoscope import bloch_sphere

bloch_sphere([[0,1,0], [0,0,1]])

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks so much, that works really great:) $\endgroup$
    – ZR-
    Mar 17, 2021 at 18:23
  • $\begingroup$ This made my day! I'd been trying to use matplotlib figures and axis and I was struggling to say the least. This made it so easy! Will be exploring Kaleidescope further! $\endgroup$
    – PGibbon
    Feb 14 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.