Skip to main content
`Ctrl`+`K`

# custom_ucd_coord_meta_mapping

astropy.visualization.wcsaxes.custom_ucd_coord_meta_mapping(mapping, *, overwrite=False)

  A context manager that makes it possible to temporarily add new UCD+ to WCS coordinate plot metadata mappings.

  Parameters:
    mapping `python:dict`

      A dictionary mapping a UCD to coordinate plot metadata. Note that custom UCD names have their “custom:” prefix stripped.

    overwrite bool

      If `True` overwrite existing entries with `mapping`.

  Examples

      >>> from matplotlib import pyplot as plt
      >>> from astropy.visualization.wcsaxes.wcsapi import custom_ucd_coord_meta_mapping
      >>> from astropy.wcs.wcsapi.fitswcs import custom_ctype_to_ucd_mapping
      >>> wcs = WCS(naxis=1)
      >>> wcs.wcs.ctype = ["eggs"]
      >>> wcs.wcs.cunit = ["deg"]
      >>> custom_mapping = {"eggs": "custom:pos.eggs"}
      >>> with custom_ctype_to_ucd_mapping(custom_mapping):
      ...     custom_meta = {
      ...         "pos.eggs": {
      ...             "coord_wrap": 360.0 * u.deg,
      ...             "format_unit": u.arcsec,
      ...             "coord_type": "longitude",
      ...         }
      ...     }
      ...     with custom_ucd_coord_meta_mapping(custom_meta):
      ...        fig = plt.figure()
      ...        ax = fig.add_subplot(111, projection=wcs)
      ...        ax.coords
      <CoordinatesMap with 1 world coordinates:

        index       aliases           type   unit  wrap format_unit visible
                                                   deg
        ----- -------------------- --------- ---- ----- ----------- -------
            0 custom:pos.eggs eggs longitude  deg 360.0      arcsec     yes

      >