Skip to content

Commit

Permalink
qsphere plotting with mpl styles (Qiskit#4812)
Browse files Browse the repository at this point in the history
* fixing color of sphere and inner phase wheel

fixes issue Qiskit#4784

* fixing color of sphere and inner phase wheel

fixes issue Qiskit#4784

* style label colors on plot_bloch_vector

Co-authored-by: Luciano Bello <luciano.bello@ibm.com>
  • Loading branch information
albi3ro and Luciano Bello authored Sep 26, 2020
1 parent 6ff5377 commit 8ff6aa8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion qiskit/visualization/bloch.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def __init__(self, fig=None, axes=None, view=None, figsize=None,
self.zlpos = [1.2, -1.2]
# ---font options---
# Color of fonts, default = 'black'
self.font_color = 'black'
self.font_color = plt.rcParams['axes.labelcolor']
# Size of fonts, default = 20
self.font_size = 20

Expand Down
6 changes: 3 additions & 3 deletions qiskit/visualization/state_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ def plot_state_qsphere(state, figsize=None, ax=None, show_state_labels=True,
x = np.outer(np.cos(u), np.sin(v))
y = np.outer(np.sin(u), np.sin(v))
z = np.outer(np.ones(np.size(u)), np.cos(v))
ax.plot_surface(x, y, z, rstride=1, cstride=1, color='k',
alpha=0.05, linewidth=0)
ax.plot_surface(x, y, z, rstride=1, cstride=1, color=plt.rcParams['grid.color'],
alpha=0.2, linewidth=0)

# Get rid of the panes
ax.w_xaxis.set_pane_color((1.0, 1.0, 1.0, 0.0))
Expand Down Expand Up @@ -829,7 +829,7 @@ def plot_state_qsphere(state, figsize=None, ax=None, show_state_labels=True,

ax2 = fig.add_subplot(gs[2:, 2:])
ax2.pie(theta, colors=sns.color_palette("hls", n), radius=0.75)
ax2.add_artist(Circle((0, 0), 0.5, color='white', zorder=1))
ax2.add_artist(Circle((0, 0), 0.5, color=plt.rcParams['figure.facecolor'], zorder=1))
offset = 0.95 # since radius of sphere is one.

if use_degrees:
Expand Down

0 comments on commit 8ff6aa8

Please sign in to comment.