Created
February 17, 2026 14:16
-
-
Save tomhepz/083cc8497400435a8fda1022ca3dd238 to your computer and use it in GitHub Desktop.
Modern plotting interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| fig = plt.figure(figsize=(3+3/8,4),constrained_layout=True) | |
| gsmain = fig.add_gridspec(2,1,height_ratios=[1,2]) | |
| ax_hide, ax_broad = gsmain[0].subgridspec(1, 2, width_ratios=[1,2]).subplots() | |
| gs_bottom = gsmain[1].subgridspec(1, 2, width_ratios=[4,5]) | |
| ax_near_0_deg, ax_near_90_deg = gs_bottom[0].subgridspec(2, 1).subplots(sharex='col', sharey=True,squeeze=True) | |
| ax_magic, ax_perp_para = gs_bottom[1].subgridspec(2, 1,height_ratios=[3,1]).subplots(sharex='col', sharey=False,squeeze=True) | |
| left_frac_keep = 0.035 | |
| fig.get_layout_engine().set(rect=(left_frac_keep,0,1-left_frac_keep,1)) | |
| fig.get_layout_engine().set(w_pad= 1 / 72, h_pad= 1 / 72, hspace=0.03, | |
| wspace=0.03) | |
| fig.savefig('Fig1_single_col_before_inkscape.svg') | |
| # Include in latex as: | |
| # (DO NOT manually set width, the width is set with plt.figure, | |
| # if you let latex choose, the font size will end up wrong) | |
| """ | |
| \begin{figure} | |
| \centering | |
| \includegraphics{Figures/finding-magic-after-inkscape-post-review.pdf} | |
| \caption{caption} | |
| \label{fig:label-me} | |
| \end{figure} | |
| """ | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment