Skip to content

dq.plot.hinton

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.random.complex(key, (16, 16))
>>> dq.plot.hinton(x)

plot_hinton_random_complex

>>> _, axs = dq.plot.grid(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.plot.grid(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(jnp.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