MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / yticks

Function yticks

lib/matplotlib/pyplot.py:2400–2482  ·  view source on GitHub ↗

Get or set the current tick locations and labels of the y-axis. Pass no arguments to return the current values without modifying them. Parameters ---------- ticks : array-like, optional The list of ytick locations. Passing an empty list removes all yticks. labels

(
    ticks: ArrayLike | None = None,
    labels: Sequence[str] | None = None,
    *,
    minor: bool = False,
    **kwargs
)

Source from the content-addressed store, hash-verified

2398
2399
2400def yticks(
2401 ticks: ArrayLike | None = None,
2402 labels: Sequence[str] | None = None,
2403 *,
2404 minor: bool = False,
2405 **kwargs
2406) -> tuple[list[Tick] | np.ndarray, list[Text]]:
2407 """
2408 Get or set the current tick locations and labels of the y-axis.
2409
2410 Pass no arguments to return the current values without modifying them.
2411
2412 Parameters
2413 ----------
2414 ticks : array-like, optional
2415 The list of ytick locations. Passing an empty list removes all yticks.
2416 labels : array-like, optional
2417 The labels to place at the given *ticks* locations. This argument can
2418 only be passed if *ticks* is passed as well.
2419 minor : bool, default: False
2420 If ``False``, get/set the major ticks/labels; if ``True``, the minor
2421 ticks/labels.
2422 **kwargs
2423 `.Text` properties can be used to control the appearance of the labels.
2424
2425 .. warning::
2426
2427 This only sets the properties of the current ticks, which is
2428 only sufficient if you either pass *ticks*, resulting in a
2429 fixed list of ticks, or if the plot is static.
2430
2431 Ticks are not guaranteed to be persistent. Various operations
2432 can create, delete and modify the Tick instances. There is an
2433 imminent risk that these settings can get lost if you work on
2434 the figure further (including also panning/zooming on a
2435 displayed figure).
2436
2437 Use `~.pyplot.tick_params` instead if possible.
2438
2439 Returns
2440 -------
2441 locs
2442 The list of ytick locations.
2443 labels
2444 The list of ylabel `.Text` objects.
2445
2446 Notes
2447 -----
2448 Calling this function with no arguments (e.g. ``yticks()``) is the pyplot
2449 equivalent of calling `~.Axes.get_yticks` and `~.Axes.get_yticklabels` on
2450 the current Axes.
2451 Calling this function with arguments is the pyplot equivalent of calling
2452 `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current Axes.
2453
2454 Examples
2455 --------
2456 >>> locs, labels = yticks() # Get the current locations and labels.
2457 >>> yticks(np.arange(0, 1, step=0.2)) # Set label locations.

Callers

nothing calls this directly

Calls 3

gcaFunction · 0.85
set_yticksMethod · 0.80
_internal_updateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…