class_docstr: Tick formatter for a longitude axis.
class_docstr_tok: ["Tick","formatter","for","a","longitude","axis","."]
docstr: Create a formatter for longitudes.
  
  When bound to an axis, the axis must be part of an axes defined
  on a rectangular projection (e.g. Plate Carree, Mercator).
  
  Parameters
  ----------
  direction_label: optional
      If *True* a direction label (E or W) will be drawn next to
      longitude labels. If *False* then these
      labels will not be drawn. Defaults to *True* (draw direction
      labels).
  zero_direction_label: optional
      If *True* a direction label (E or W) will be drawn next to
      longitude labels with the value 0. If *False* then these
      labels will not be drawn. Defaults to *False* (no direction
      labels).
  dateline_direction_label: optional
      If *True* a direction label (E or W) will be drawn next to
      longitude labels with the value 180. If *False* then these
      labels will not be drawn. Defaults to *False* (no direction
      labels).
  degree_symbol: optional
      The symbol used to represent degrees. Defaults to '°'.
  number_format: optional
      Format string to represent the latitude values when `dms`
      is set to False. Defaults to 'g'.
  transform_precision: optional
      Sets the precision (in degrees) to which transformed tick
      values are rounded. The default is 1e-7, and should be
      suitable for most use cases. To control the appearance of
      tick labels use the *number_format* keyword.
  dms: bool, optional
      Whether or not formatting as degrees-minutes-seconds and not
      as decimal degrees.
  minute_symbol: str, optional
      The character(s) used to represent the minute symbol.
  second_symbol: str, optional
      The character(s) used to represent the second symbol.
  seconds_number_format: optional
      Format string to represent the "seconds" component of the latitude
      values. Defaults to 'g'.
  auto_hide: bool, optional
      Auto-hide degrees or minutes when redundant.
  decimal_point: bool, optional
      Decimal point character. If not provided and
      ``mpl.rcParams['axes.formatter.use_locale'] == True``,
      the locale decimal point is used.
  cardinal_labels: dict, optional
      A dictionary with "west" and/or "east" keys to replace west and
      east cardinal labels, which defaults to "W" and "E".
  
  Note
  ----
      A formatter can only be used for one axis. A new formatter
      must be created for every axis that needs formatted labels.
  
  Examples
  --------
  Label longitudes from -180 to 180 on a Plate Carree projection
  with a central longitude of 0::
  
      ax = plt.axes(projection=PlateCarree())
      ax.set_global()
      ax.set_xticks([-180, -120, -60, 0, 60, 120, 180],
                    crs=ccrs.PlateCarree())
      lon_formatter = LongitudeFormatter()
      ax.xaxis.set_major_formatter(lon_formatter)
  
  Label longitudes from 0 to 360 on a Plate Carree projection
  with a central longitude of 180::
  
      ax = plt.axes(projection=PlateCarree(central_longitude=180))
      ax.set_global()
      ax.set_xticks([0, 60, 120, 180, 240, 300, 360],
                    crs=ccrs.PlateCarree())
      lon_formatter = LongitudeFormatter()
      ax.xaxis.set_major_formatter(lon_formatter)
  
  
  When not bound to an axis::
  
      lon_formatter = LongitudeFormatter()
      ticks = [0, 60, 120, 180, 240, 300, 360]
      lon_formatter.set_locs(ticks)
      labels = [lon_formatter(value) for value in ticks]
code: def __init__(
      self,
      direction_label=True,
      zero_direction_label=False,
      dateline_direction_label=False,
      degree_symbol="°",
      number_format="g",
      transform_precision=1e-8,
      dms=False,
      minute_symbol="′",
      second_symbol="″",
      seconds_number_format="g",
      auto_hide=True,
      decimal_point=None,
      cardinal_labels=None,
  ):
      """
      Create a formatter for longitudes.
  
      When bound to an axis, the axis must be part of an axes defined
      on a rectangular projection (e.g. Plate Carree, Mercator).
  
      Parameters
      ----------
      direction_label: optional
          If *True* a direction label (E or W) will be drawn next to
          longitude labels. If *False* then these
          labels will not be drawn. Defaults to *True* (draw direction
          labels).
      zero_direction_label: optional
          If *True* a direction label (E or W) will be drawn next to
          longitude labels with the value 0. If *False* then these
          labels will not be drawn. Defaults to *False* (no direction
          labels).
      dateline_direction_label: optional
          If *True* a direction label (E or W) will be drawn next to
          longitude labels with the value 180. If *False* then these
          labels will not be drawn. Defaults to *False* (no direction
          labels).
      degree_symbol: optional
          The symbol used to represent degrees. Defaults to '°'.
      number_format: optional
          Format string to represent the latitude values when `dms`
          is set to False. Defaults to 'g'.
      transform_precision: optional
          Sets the precision (in degrees) to which transformed tick
          values are rounded. The default is 1e-7, and should be
          suitable for most use cases. To control the appearance of
          tick labels use the *number_format* keyword.
      dms: bool, optional
          Whether or not formatting as degrees-minutes-seconds and not
          as decimal degrees.
      minute_symbol: str, optional
          The character(s) used to represent the minute symbol.
      second_symbol: str, optional
          The character(s) used to represent the second symbol.
      seconds_number_format: optional
          Format string to represent the "seconds" component of the latitude
          values. Defaults to 'g'.
      auto_hide: bool, optional
          Auto-hide degrees or minutes when redundant.
      decimal_point: bool, optional
          Decimal point character. If not provided and
          ``mpl.rcParams['axes.formatter.use_locale'] == True``,
          the locale decimal point is used.
      cardinal_labels: dict, optional
          A dictionary with "west" and/or "east" keys to replace west and
          east cardinal labels, which defaults to "W" and "E".
  
      Note
      ----
          A formatter can only be used for one axis. A new formatter
          must be created for every axis that needs formatted labels.
  
      Examples
      --------
      Label longitudes from -180 to 180 on a Plate Carree projection
      with a central longitude of 0::
  
          ax = plt.axes(projection=PlateCarree())
          ax.set_global()
          ax.set_xticks([-180, -120, -60, 0, 60, 120, 180],
                        crs=ccrs.PlateCarree())
          lon_formatter = LongitudeFormatter()
          ax.xaxis.set_major_formatter(lon_formatter)
  
      Label longitudes from 0 to 360 on a Plate Carree projection
      with a central longitude of 180::
  
          ax = plt.axes(projection=PlateCarree(central_longitude=180))
          ax.set_global()
          ax.set_xticks([0, 60, 120, 180, 240, 300, 360],
                        crs=ccrs.PlateCarree())
          lon_formatter = LongitudeFormatter()
          ax.xaxis.set_major_formatter(lon_formatter)
  
  
      When not bound to an axis::
  
          lon_formatter = LongitudeFormatter()
          ticks = [0, 60, 120, 180, 240, 300, 360]
          lon_formatter.set_locs(ticks)
          labels = [lon_formatter(value) for value in ticks]
      """
      super().__init__(
          direction_label=direction_label,
          degree_symbol=degree_symbol,
          number_format=number_format,
          transform_precision=transform_precision,
          dms=dms,
          minute_symbol=minute_symbol,
          second_symbol=second_symbol,
          seconds_number_format=seconds_number_format,
          auto_hide=auto_hide,
          decimal_point=decimal_point,
          cardinal_labels=cardinal_labels,
      )
      self._zero_direction_labels = zero_direction_label
      self._dateline_direction_labels = dateline_direction_label
  
imports: import matplotlib
  from matplotlib.ticker import Formatter, MaxNLocator
  import numpy
  import cartopy.crs
  from cartopy.mpl.geoaxes import GeoAxes
label_desc: Use image node_id 1 to create a new LongitudeFormatter object from inherited base classes: _PlateCarreeFormatter with example: obj = LongitudeFormatter(direction_label, zero_direction_label, dateline_direction_label, degree_symbol, number_format, transform_precision, dms, minute_symbol, second_symbol, seconds_number_format, auto_hide, decimal_point, cardinal_labels)