Skip to content

dq.plot_hinton

plot_hinton(
    x: ArrayLike,
    *,
    ax: Axes | None = None,
    cmap: str | None = None,
    vmin: float | None = None,
    vmax: float | None = None,
    colorbar: bool = True,
    allticks: bool = False,
    tickslabel: list[str] | None = None,
    ecolor: str = "white",
    ewidth: float = 0.5,
    clear: bool = False
)

Plot a Hinton diagram.

Warning

Documentation redaction in progress.

Examples

>>> rho = dq.coherent_dm(16, 2.0)
>>> dq.plot_hinton(jnp.abs(rho))

plot_hinton_coherent

>>> a = dq.destroy(16)
>>> H = dq.dag(a) @ a + 2.0 * (a + dq.dag(a))
>>> dq.plot_hinton(jnp.abs(H))

plot_hinton_hamiltonian

>>> cnot = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]
>>> dq.plot_hinton(cnot, tickslabel=['00', '01', '10', '11'])

plot_hinton_cnot

>>> key = jax.random.PRNGKey(42)
>>> x = dq.rand_complex(key, (16, 16))
>>> dq.plot_hinton(x)

plot_hinton_rand_complex

>>> _, axs = dq.gridplot(2)
>>> psi = dq.unit(dq.fock(4, 0) - dq.fock(4, 2))
>>> dq.plot_hinton(dq.todm(psi), ax=next(axs))
>>> rho = dq.unit(dq.fock_dm(4, 0) + dq.fock_dm(4, 2))
>>> dq.plot_hinton(rho, ax=next(axs))

plot_hinton_fock02

>>> _, axs = dq.gridplot(2)
>>> x = np.random.uniform(-1.0, 1.0, (10, 10))
>>> dq.plot_hinton(x, ax=next(axs), vmin=-1.0, vmax=1.0)
>>> dq.plot_hinton(np.abs(x), ax=next(axs), cmap='Greys', vmax=1.0, ecolor='black')

plot_hinton_real

>>> x = np.random.uniform(-1.0, 1.0, (100, 100))
>>> dq.plot_hinton(x, vmin=-1.0, vmax=1.0, ewidth=0, clear=True, w=20)

plot_hinton_large