.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/axis_and_tick/98.colored_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_gallery_axis_and_tick_98.colored_axes.py: ============ Colored axes ============ You can give a different color for each axis. .. GENERATED FROM PYTHON SOURCE LINES 9-40 .. image-sg:: /gallery/axis_and_tick/images/sphx_glr_98.colored_axes_001.svg :alt: 98.colored axes :srcset: /gallery/axis_and_tick/images/sphx_glr_98.colored_axes_001.svg :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt from mpltern.datasets import get_spiral fig = plt.figure() ax = fig.add_subplot(projection='ternary') ax.plot(*get_spiral(), color='k') ax.set_tlabel('Top') ax.set_llabel('Left') ax.set_rlabel('Right') ax.grid() # Color ticks, grids, tick-labels ax.taxis.set_tick_params(tick2On=True, colors='C0', grid_color='C0') ax.laxis.set_tick_params(tick2On=True, colors='C1', grid_color='C1') ax.raxis.set_tick_params(tick2On=True, colors='C2', grid_color='C2') # Color labels ax.taxis.label.set_color('C0') ax.laxis.label.set_color('C1') ax.raxis.label.set_color('C2') # Color spines ax.spines['tside'].set_color('C0') ax.spines['lside'].set_color('C1') ax.spines['rside'].set_color('C2') plt.show() .. _sphx_glr_download_gallery_axis_and_tick_98.colored_axes.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 98.colored_axes.ipynb <98.colored_axes.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 98.colored_axes.py <98.colored_axes.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_