# Introducing Quantum Plots

Plots are an integral part of almost every publication. But designing a plot is usually only the first step. It has also be adjusted to fit into your publication in terms of size, style and font. Of course, one can always use Tikz to produce plots that integrate well with LaTeX documents, but most authors either find this too complex or still want to use their favourite plotting tools.

To this end, Quantum provides Quantum Plots, a Jupyter notebook based on the popular and widely used library matplotlib. It is intended as a tool to streamline the process of making publication-ready plots intended for submission to Quantum. The notebook will automatically set plot options and font sizes in a way that matches the exact style of your submission to quantum, while still leaving you full flexibility to adjust every parameter to your wishes. In the following, we will outline how to use Quantum Plots to make appealing figures for your publication.

Note that Quantum firmly believes that authors themselves know best how to present their research. Using Quantum Plots is thus entirely optional and it is only provided as a means to make the process of creating a coherent publication easier for authors.

## How to use Quantum Plots

You can download the current version of quantum-plots.ipynb and the style file quantum-plots.mplstyle from [GitHub]. You need to place them in the same folder.

You can now use Jupyter to open the notebook. Run the first cell of the notebook to load all the necessary code for plotting.

Global setup

Before you can make a plot, you have to tell Quantum Plots how your quantumarticle is set up. This is achieved by running the routine global_setup which has the following parameters:

 Parameter Possible Values columns twocolumn, onecolumn paper a4paper, letterpaper fontsize 10, 11, 12

Where the underlined options represent the default settings. As an example, if your quantumarticle is set up in the following way:

\documentclass[a4paper,onecolumn,12pt]{quantumarticle}

Then you have to call global_setup with the following parameters:

props = global_setup(columns = ‘onecolumn’, paper = ‘a4paper’, fontsize = 12)

The routine global_setup will return a dictionary that contains fontsizes and quantum specific colors that you can use to adjust your plots in a LaTeX-compatible way. For example, the font size LARGE that corresponds to your quantumarticle setup is given by

props[‘fontsizes’][‘LARGE’]

Where the characteristic Quantum violet is given by

props[‘colors’][‘quantumviolet’]

The whole content of the dictionary is shown in the notebook.

Plot setup

After global setup is complete, you can set up your individual plots. This is achieved by calling the method plot_setup which has the following parameters:

 Parameter Possible Values aspect_ratio Positive float, defaults to the golden ratio width_ratio Float between 0 and 1, defaults to 1 wide True or False, defaults to False

The aspect ratio will give the ratio between width and height of your plot. The width_ratio gives the width of your plot as a function of the width of your text column. If you have a plot that you would normally include via

\includegraphics[width=.8\columnwidth]{...}

you would use width_ratio = 0.8 and include the plot in your document without giving a width (because it will already be correct)

\includegraphics{...}

The parameter wide is intended for use in the twocolumn layout of quantumarticle. If wide = True, then the base width of your plot is that of a figure* that spans two columns.

As an example, consider a quadratic plot that is intended to take up 90% of the columnwidth. This is achieved by

fig = plot_setup(aspect_ratio = 1.0, width_ratio = 0.9)

If you want to make a plot that has the golden ratio as aspect ratio and that spans 80% of the two columns in a two column layout, you have to call

fig = plot_setup(width_ratio = 0.8, wide = True)

As you see, plot_setup will return a matplotlib Figure object that you can use to further manipulate your plot.

Plots should always be saved as PDF files via plt.savefig('filename.pdf'). This will result in the highest quality graphics that can seamlessly integrated in your publications.

We further recommend that you use plt.tight_layout() on your plots.

## Examples

The notebook itself contains a wide range of examples of different plots. Consider the following example plots which you will find in the notebook along with the code that was used to generate them:

## Under the hood

The seamless integration with the quantumarticle document class is achieved by multiple means. First, the appropriate sizes for the plots were determined by measuring the columnwidths in latex and then hardcoded into the notebook. Second, the fonts are exactly the same because the pgf-backend of matplotlib is used. This enables the use of LaTeX, which gives us the possibility to load the exact same packages that are loaded by quantumarticle, ensuring that serif- and sans-serif-fonts are displayed correctly. Third, the style options were set in a way to harmonize with the style of the quantumarticle document class.

## A word of caution

Quantum Plots is still in beta stage. In case you have suggestions, ideas or the notebook does not run smoothly, please open an Issue on our [GitHub page https://github.com/quantum-journal/quantum-journal/issues] and append the following information:

• The error message (you can include the whole output as .html).
• The version of Jupyter notebook and IPython (as found in the menu under Help > About).
• The version of Matplotlib and the current backend. This information can be found by running the following code:
print(mpl.__version__) print(mpl.get_backend())

You will help us tremendously in improving your experience.

Should you have the problem that your figures are not displayed in the Jupyter notebook, you can still save them as PDF documents via plt.savefig('filename.pdf'). Afterwards you can use your favorite PDF viewer to check your figures. Nevertheless you should inform us so that the bug can be removed.