This repository offers a minimum working example for a Python plotting tool which may be used with the TU Delft thesis template - my thesis is found here. This code enables plots with the Utopia font used in the TU Delft thesis template or any other font that is selected in the beginning of the plotting file.
Figure 1: Motor test example (compressed PNG file)
Figure 1 shows an example from my thesis. The code is found the bottom minimum_working.py
and the raw data is in data_file_example.csv
. The plot contains two axes subplots, with the top one divided into two, resulting in three subplots. The x-axes is shared and the y-axes are different for every subplot. Each subplot has its own legend.
See this article for explanation of the set_size
function and about font sizing. It comes down to defining the number you would use in Latex in \includegraphics[width=0.5\textwidth]{my-uploaded-figure.png}
(at Overleaf), the 0.5 in this case, as the width of the figure. Matplotlib then ensures that the text size in the figure is the same as the text size.
I altered set_size
function slightly to ensure I could change the height of the plots (sometimes I needed thinner, longer plots).
pip install pandas matplotlib seaborn scipy
- Download Utopia font
- Recommended: Visual Studio Code
- Structure: I used a
.py
file to write the code for all my plots and a.ipynb
notebook to execute the plotting functions and organise myself. This resulted in a very structured and easy to understand notebook with all my plots (Figure 2). - Plot in
pdf
format, from the beginning, always. - Use wise filenames, I suggest including the
get_timestamp
so that you know when you plotted it.