ZtoRGBpy

Version 1.0.1 Documentation

ZtoRGBpy.colorbar

colorbar(mappable=None, ax=None, cax=None, scale=None, profile=None, use_gridspec=True, **kw)[source]

Generate a Matplotlib Colorbar

Renders a special colorbar showing phase rotation on the opposite axis to the magnitude (no axis labels)

Parameters:
  • mappable (AxesImage with ZtoRGBpy meta data, optional, default: None) – An AxesImage as returned by imshow or colorwheel. Defaults to the current image, if None.
  • ax (Axes, list of Axes, optional, default: None) – Parent axes from which space for a new colorbar axes will be stolen. If a list of axes is given they will all be resized to make room for the colorbar axes.
  • cax (Axes, optional, default: None) – Axes into which the colorbar will be drawn.
  • scale (Scale, optional, default: None) – Scale used by the mapping that the colorbar represents. Defaults to the scale include in the ZtoRGBpy meta data for the mappable being used,
  • profile (RGBColorProfile, optional, default: None) – RGBColorProfile used by the mapping that the colorbar represents. Defaults to the profile include in the ZtoRGBpy meta data for the mappable being used,
  • use_gridspec (bool, optional, default: True) – If cax is None, a new cax is created as an instance of Axes. If ax is an instance of Subplot and use_gridspec is True, cax is created as an instance of Subplot using the grid_spec module.
Other Parameters:
 

**kwargs (matplotlib.colorbar.make_axes parameters) – These parameters are passed to the underlying matplotlib function, used to generate the colorbar axes

Returns:

  • image (AxesImage) – image object representing the colorbar
  • axes (Axes) – axes for the image object representing the colorbar

Example

>>> import ZtoRGBpy
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> r = np.linspace(-5,5, 2001)
>>> x,y = np.meshgrid(r,r)
>>> z = x + 1j*y
>>> ZtoRGBpy.imshow(np.cos(z), extent=[-5,5,-5,5])
>>> ZtoRGBpy.colorbar()
>>> plt.show()

(png, hires.png, pdf)

../../_images/ZtoRGBpy-colorbar-1.png