qiskit/releasenotes/notes/0.22/plot-hist-797bfaeea2156c53....

35 lines
1.4 KiB
YAML

---
features:
- |
Added a new function :func:`~.plot_distribution` for plotting distributions over quasi-probabilities.
This is suitable for ``Counts``, ``QuasiDistribution`` and ``ProbDistribution``.
Raw `dict` can be passed as well. For example:
.. code-block::
from qiskit.visualization import plot_distribution
quasi_dist = {'0': .98, '1': -.01}
plot_distribution(quasi_dist)
upgrade:
- |
The :func:`~.plot_histogram` function has been modified to return an actual
histogram of discrete binned values. The previous behavior for the function
was despite the name to actually generate a visualization of the distribution
of the input. Due to this disparity between the name of the function and the behavior
the function behavior was changed so it's actually generating a proper histogram
of discrete data now. If you wish to preserve the previous behavior of plotting a
probability distribution of the counts data you can leverage the :func:`~.plot_distribution` to generate an
equivalent graph. For example, the previous behavior of
``plot_histogram({'00': 512, '11': 500})`` can be re-created with:
.. code-block::
from qiskit.visualization import plot_distribution
import matplotlib.pyplot as plt
ax = plt.subplot()
plot_distribution({'00': 512, '11': 500}, ax=ax)
ax.set_ylabel('Probabilities')