.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/axes_grid1/make_room_for_ylabel_using_axesgrid.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. meta:: :keywords: codex .. 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_gallery_axes_grid1_make_room_for_ylabel_using_axesgrid.py: ==================================== Make room for ylabel using axes_grid ==================================== .. GENERATED FROM PYTHON SOURCE LINES 6-19 .. code-block:: Python import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable fig = plt.figure() ax = fig.add_axes([0, 0, 1, 1]) ax.set_yticks([0.5], labels=["very long label"]) make_axes_area_auto_adjustable(ax) .. image-sg:: /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_001.png :alt: make room for ylabel using axesgrid :srcset: /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_001.png, /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_001_2_00x.png 2.00x :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 20-33 .. code-block:: Python fig = plt.figure() ax1 = fig.add_axes([0, 0, 1, 0.5]) ax2 = fig.add_axes([0, 0.5, 1, 0.5]) ax1.set_yticks([0.5], labels=["very long label"]) ax1.set_ylabel("Y label") ax2.set_title("Title") make_axes_area_auto_adjustable(ax1, pad=0.1, use_axes=[ax1, ax2]) make_axes_area_auto_adjustable(ax2, pad=0.1, use_axes=[ax1, ax2]) .. image-sg:: /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_002.png :alt: Title :srcset: /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_002.png, /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_002_2_00x.png 2.00x :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 34-56 .. code-block:: Python fig = plt.figure() ax1 = fig.add_axes([0, 0, 1, 1]) divider = make_axes_locatable(ax1) ax2 = divider.append_axes("right", "100%", pad=0.3, sharey=ax1) ax2.tick_params(labelleft=False) fig.add_axes(ax2) divider.add_auto_adjustable_area(use_axes=[ax1], pad=0.1, adjust_dirs=["left"]) divider.add_auto_adjustable_area(use_axes=[ax2], pad=0.1, adjust_dirs=["right"]) divider.add_auto_adjustable_area(use_axes=[ax1, ax2], pad=0.1, adjust_dirs=["top", "bottom"]) ax1.set_yticks([0.5], labels=["very long label"]) ax2.set_title("Title") ax2.set_xlabel("X - Label") plt.show() .. image-sg:: /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_003.png :alt: Title :srcset: /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_003.png, /gallery/axes_grid1/images/sphx_glr_make_room_for_ylabel_using_axesgrid_003_2_00x.png 2.00x :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.858 seconds) .. _sphx_glr_download_gallery_axes_grid1_make_room_for_ylabel_using_axesgrid.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: make_room_for_ylabel_using_axesgrid.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: make_room_for_ylabel_using_axesgrid.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_