.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/axis_and_tick/21.tick-locators.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_21.tick-locators.py: ============= Tick locators ============= `Tick locators can be given both for major and minor ticks in the same way as Matplotlib `__. Gridlines for minor ticks can be also plotted. .. GENERATED FROM PYTHON SOURCE LINES 10-38 .. image-sg:: /gallery/axis_and_tick/images/sphx_glr_21.tick-locators_001.svg :alt: 21.tick locators :srcset: /gallery/axis_and_tick/images/sphx_glr_21.tick-locators_001.svg :class: sphx-glr-single-img .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator, AutoMinorLocator import mpltern ax = plt.subplot(projection="ternary") np.random.seed(19680801) t, l, r = np.random.dirichlet(alpha=(2.0, 4.0, 8.0), size=128).T ax.scatter(t, l, r, s=64.0, c="C1", edgecolors="k", alpha=0.6) ax.set_tlabel("$x_1$") ax.set_llabel("$x_2$") ax.set_rlabel("$x_3$") ax.taxis.set_major_locator(MultipleLocator(0.25)) ax.laxis.set_major_locator(MultipleLocator(0.20)) ax.raxis.set_major_locator(MultipleLocator(0.10)) ax.laxis.set_minor_locator(MultipleLocator(0.1)) ax.raxis.set_minor_locator(AutoMinorLocator(5)) ax.grid(axis='t') ax.grid(axis='l', which='minor', linestyle='--') ax.grid(axis='r', which='both', linestyle=':') plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.696 seconds) .. _sphx_glr_download_gallery_axis_and_tick_21.tick-locators.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 21.tick-locators.ipynb <21.tick-locators.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 21.tick-locators.py <21.tick-locators.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_