MCPcopy Index your code
hub / github.com/pydata/xarray / _set_concise_date

Function _set_concise_date

xarray/plot/utils.py:1846–1867  ·  view source on GitHub ↗

Use ConciseDateFormatter which is meant to improve the strings chosen for the ticklabels, and to minimize the strings used in those tick labels as much as possible. https://matplotlib.org/stable/gallery/ticks/date_concise_formatter.html Parameters ---------- ax : Axes

(ax: Axes, axis: Literal["x", "y", "z"] = "x")

Source from the content-addressed store, hash-verified

1844
1845
1846def _set_concise_date(ax: Axes, axis: Literal["x", "y", "z"] = "x") -> None:
1847 """
1848 Use ConciseDateFormatter which is meant to improve the
1849 strings chosen for the ticklabels, and to minimize the
1850 strings used in those tick labels as much as possible.
1851
1852 https://matplotlib.org/stable/gallery/ticks/date_concise_formatter.html
1853
1854 Parameters
1855 ----------
1856 ax : Axes
1857 Figure axes.
1858 axis : Literal["x", "y", "z"], optional
1859 Which axis to make concise. The default is "x".
1860 """
1861 import matplotlib.dates as mdates
1862
1863 locator = mdates.AutoDateLocator()
1864 formatter = mdates.ConciseDateFormatter(locator)
1865 _axis = getattr(ax, f"{axis}axis")
1866 _axis.set_major_locator(locator)
1867 _axis.set_major_formatter(formatter)

Callers 3

lineFunction · 0.90
_add_labelsFunction · 0.90
newplotfuncFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…