.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/panel/test_panel_axes.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_panel_test_panel_axes.py: --------------- Panel Placement --------------- .. GENERATED FROM PYTHON SOURCE LINES 6-44 .. image-sg:: /examples/panel/images/sphx_glr_test_panel_axes_001.png :alt: Title, Title, Title, Title :srcset: /examples/panel/images/sphx_glr_test_panel_axes_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/mpl-visual-context/checkouts/no_contour/examples/panel/test_panel_axes.py:42: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect. fig.tight_layout() | .. code-block:: Python import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable # from mpl_visual_context.axes_panel import axis_to_panels, title_to_panel from mpl_visual_context.axes_panel import InsetDivider, AxesDivider from mpl_visual_context.axes_panel import add_panel fig, axs = plt.subplots(2, 2, num=1, clear=True) fig.tight_layout() for ax, which in zip( axs.flat, [["label"], ["ticklabels"], ["label", "ticklabels"], ["ticklabels", "label"]], ): ax.set_ylabel("Y-label") ax.set_xlabel("X-label") ax.set_title("Title") # divider = AxesDivider(ax) divider = InsetDivider(ax) ax_host = ax for w in which: ax1 = add_panel(divider, "left", w, pad=0) ax_host = ax1 ax_host = ax for w in which: ax1 = add_panel(divider, "bottom", w, pad=0) ax_host = ax1 add_panel(divider, "top", "title", pad=0) fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.890 seconds) .. _sphx_glr_download_examples_panel_test_panel_axes.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: test_panel_axes.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: test_panel_axes.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: test_panel_axes.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_