Skip to content

Commit

Permalink
Update state_visualization.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sg495 committed Nov 14, 2021
1 parent a603740 commit 0fed2c3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions qiskit/visualization/state_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def plot_bloch_multivector(
Args:
state (Statevector or DensityMatrix or ndarray): an N-qubit quantum state.
title (str): a string that represents the plot title
figsize (tuple): Has no effect, here for compatibility only.
figsize (tuple): size of each individual Bloch sphere figure, in inches.
reverse_bits (bool): If True, plots qubits following Qiskit's convention [Default:False].
Returns:
Expand Down Expand Up @@ -289,7 +289,11 @@ def plot_bloch_multivector(
_bloch_multivector_data(state)[::-1] if reverse_bits else _bloch_multivector_data(state)
)
num = len(bloch_data)
width, height = plt.figaspect(1 / num)
if figsize is not None:
width, height = figsize
width *= num
else:
width, height = plt.figaspect(1 / num)
fig = plt.figure(figsize=(width, height))
for i in range(num):
pos = num - 1 - i if reverse_bits else i
Expand Down

0 comments on commit 0fed2c3

Please sign in to comment.