Skip to content

Commit

Permalink
improving basis states plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
Phionx committed May 2, 2024
1 parent 4adf928 commit 292cb4f
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 31 deletions.
10 changes: 8 additions & 2 deletions bosonic_jax/codes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,21 @@ def plot_code_states(self, qp_type: str = jqt.WIGNER, **kwargs):
pos = (i // 3, i % 3)
ax = axs[pos]
w_plt = self._plot_single(state, ax=ax, qp_type=qp_type, **kwargs)
ax.set_title(label)
ax.set_title(f"|{label}" + r"$\rangle$")
ax.set_xlabel(r"Re[$\alpha$]")
ax.set_ylabel(r"Im[$\alpha$]")

fig.suptitle(self.name)
fig.tight_layout()
fig.subplots_adjust(right=0.8, hspace=0.2, wspace=0.2)
cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
fig.align_xlabels(axs)
fig.align_ylabels(axs)
cbar_ax = fig.add_axes([0.85 + 0.2, 0.15, 0.05, 0.7])

ticks = np.linspace(vmin, vmax, 5)
fig.colorbar(w_plt, cax=cbar_ax, ticks=ticks)

cbar_ax.set_title(cbar_title, pad=20)
fig.tight_layout()
plt.show()

27 changes: 13 additions & 14 deletions tutorials/binomial/1-codes.ipynb

Large diffs are not rendered by default.

25 changes: 12 additions & 13 deletions tutorials/cat/1-codes.ipynb

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions tutorials/gkp/1-codes.ipynb

Large diffs are not rendered by default.

0 comments on commit 292cb4f

Please sign in to comment.