Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements to PL plot style #4690

Merged
merged 12 commits into from
Oct 19, 2023
10 changes: 9 additions & 1 deletion doc/code/qml_drawer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ be reset with ``qml.drawer.use_style('black_white')``.
available_styles
use_style

The following images are generated via the code:
The following images are generated via the following code, where ``style`` is
replaced by an available style specification string (e.g., ``pennylane`` or
``solarized_light``):
ikurecic marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: python

Expand All @@ -42,6 +44,12 @@ The following images are generated via the code:
qml.drawer.use_style(style)
fig, ax = qml.draw_mpl(circuit)(1.2345, 1.2345)

Note that the shown ``pennylane`` style can be replicated exactly by having the
ikurecic marked this conversation as resolved.
Show resolved Hide resolved
Quicksand Bold font installed and refreshing the Matplotlib font cache (by
deleting the ``fontlist`` file in the Matplotlib cache directory) — to find the
cache directory, run ``matplotlib.get_cachedir()``. If this font is not
available, the drawer will fall back on a default font.
ikurecic marked this conversation as resolved.
Show resolved Hide resolved

Currently Available Styles
^^^^^^^^^^^^^^^^^^^^^^^^^^
.. |bws| image:: ../_static/style/black_white_style.png
ikurecic marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
15 changes: 13 additions & 2 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@
of the computed qubit operator, if imaginary components are smaller than a threshold.
[(#4639)](https://github.com/PennyLaneAI/pennylane/pull/4639)

* Plots generated with the `pennylane.drawer.plot` style of `matplotlib.pyplot` now have black
axis labels and are generated at a default DPI of 300.
[(#4690)](https://github.com/PennyLaneAI/pennylane/pull/4690)


<h3>Breaking changes 💔</h3>

Expand Down Expand Up @@ -359,7 +363,13 @@
Note that these functions are unstable while device upgrades are underway.
[(#4555)](https://github.com/PennyLaneAI/pennylane/pull/4555)

* Minor documentation improvement to the usage example in the `qml.QuantumMonteCarlo` page. Integral was missing the differential dx with respect to which the integration is being performed. [(#4593)](https://github.com/PennyLaneAI/pennylane/pull/4593)
* Minor documentation improvement to the usage example in the `qml.QuantumMonteCarlo` page.
Integral was missing the differential dx with respect to which the integration is being performed.
[(#4593)](https://github.com/PennyLaneAI/pennylane/pull/4593)

* Minor documentation improvement for the use of the `pennylane` style of `qml.drawer` and the
`pennylane.drawer.plot` style of `matplotlib.pyplot`. The use of the default font was clarified.
[(#4690)](https://github.com/PennyLaneAI/pennylane/pull/4690)

<h3>Bug fixes 🐛</h3>

Expand Down Expand Up @@ -402,7 +412,8 @@ Stepan Fomichev,
Joana Fraxanet,
Diego Guala,
Soran Jahangiri,
Korbinian Kottmann
Korbinian Kottmann,
Ivana Kurecic,
Christina Lee,
Lillian M. A. Frederiksen,
Vincent Michaud-Rioux,
Expand Down
7 changes: 5 additions & 2 deletions pennylane/drawer/plot.mplstyle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# PennyLane plot palette
# To use the Quicksand Bold font, first install it and then refresh the Matplotlib font cache (delete the fontlist file in the cache directory). To find the cache directory location, run matplotlib.get_cachedir()
axes.prop_cycle: cycler('color', ['70CEFF', 'FF87EB', 'FFE096', 'D7A2F6', 'FDC9DE', 'E1EBA8', 'C6FDD9', 'B5F2ED'])

patch.linewidth: 0.5
Expand All @@ -11,7 +12,7 @@ axes.edgecolor: BCBABA
axes.linewidth: 1
axes.grid: True
axes.titlesize: x-large
axes.labelcolor: BCBABA
axes.labelcolor: black

xtick.color: black
xtick.direction: out
Expand All @@ -22,4 +23,6 @@ grid.color: F0EEEF
grid.linestyle: :

font.sans-serif: Quicksand, DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
font.weight: bold
font.weight: bold

figure.dpi: 300
Loading