Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé
Module « matplotlib.pyplot »

Classe « ScalarFormatter »

Informations générales

Héritage

builtins.object
    TickHelper
        Formatter
            ScalarFormatter

Définition

class ScalarFormatter(Formatter):

help(ScalarFormatter)

Format tick values as a number.

Parameters
----------
useOffset : bool or float, default: :rc:`axes.formatter.useoffset`
    Whether to use offset notation. See `.set_useOffset`.
useMathText : bool, default: :rc:`axes.formatter.use_mathtext`
    Whether to use fancy math formatting. See `.set_useMathText`.
useLocale : bool, default: :rc:`axes.formatter.use_locale`.
    Whether to use locale settings for decimal sign and positive sign.
    See `.set_useLocale`.
usetex : bool, default: :rc:`text.usetex`
    To enable/disable the use of TeX's math mode for rendering the
    numbers in the formatter.

    .. versionadded:: 3.10

Notes
-----
In addition to the parameters above, the formatting of scientific vs.
floating point representation can be configured via `.set_scientific`
and `.set_powerlimits`).

**Offset notation and scientific notation**

Offset notation and scientific notation look quite similar at first sight.
Both split some information from the formatted tick values and display it
at the end of the axis.

- The scientific notation splits up the order of magnitude, i.e. a
  multiplicative scaling factor, e.g. ``1e6``.

- The offset notation separates an additive constant, e.g. ``+1e6``. The
  offset notation label is always prefixed with a ``+`` or ``-`` sign
  and is thus distinguishable from the order of magnitude label.

The following plot with x limits ``1_000_000`` to ``1_000_010`` illustrates
the different formatting. Note the labels at the right edge of the x axis.

.. plot::

    lim = (1_000_000, 1_000_010)

    fig, (ax1, ax2, ax3) = plt.subplots(3, 1, gridspec_kw={'hspace': 2})
    ax1.set(title='offset notation', xlim=lim)
    ax2.set(title='scientific notation', xlim=lim)
    ax2.xaxis.get_major_formatter().set_useOffset(False)
    ax3.set(title='floating-point notation', xlim=lim)
    ax3.xaxis.get_major_formatter().set_useOffset(False)
    ax3.xaxis.get_major_formatter().set_scientific(False)

Constructeur(s)

Signature du constructeur Description
__init__(self, useOffset=None, useMathText=None, useLocale=None, *, usetex=None)

Liste des attributs statiques

Nom de l'attribut Valeur
axisNone
locs[]

Liste des propriétés

Nom de la propriétéDescription
useLocale
useMathText
useOffset
usetex

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__call__(self, x, pos=None)
format_data(self, value)
format_data_short(self, value)
get_offset(self)
get_useLocale(self)
get_useMathText(self)
get_useOffset(self)
get_usetex(self)
set_locs(self, locs)
set_powerlimits(self, lims)
set_scientific(self, b)
set_useLocale(self, val)
set_useMathText(self, val)
set_useOffset(self, val)
set_usetex(self, val)

Méthodes héritées de la classe Formatter

__init_subclass__, __subclasshook__, fix_minus, format_ticks

Méthodes héritées de la classe TickHelper

create_dummy_axis, set_axis

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé