Contours

utilities.plotUtilities.singleContour(X, Y, Z, contours=None, sizeFig=(12, 12), aspect='equal', hideAllTicks=False, cmap='plasma', colorbar=True, norm='log', cut=None, xlim=None, ylim=None, title=None, filled='both')[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Draw a (filled) contour plot.

Parameters
  • X (meshgrid ndarray) – grid containing the x-axis values for each pixel

  • Y (meshgrid ndarray) – grid containing the y-axis values for each pixel

  • Z (meshgrid ndarray) – grid containing the z-axis values for each pixel. This will correspond to the contour values.

  • aspect (str) – (Optional) aspect of the plot

  • cmap (str) – (Optional) colormap to use

  • colorbar (bool) – (Optional) whether to draw a colorbar or not

  • contours (int or list[int] or list[float]) –

    (Optional) contours to draw

    • if an int, it must be the number of contours to draw

    • if a list, it must be the contour values

    • if None, its value will be determined automatically (see matplotlib)

  • cut (float) – (Optional) cut below which values in the Z data are put to np.nan. If None, no cut is applied.

  • filled (bool or str) – (Optional) whether to draw a filled contour (if True) or just contours (if False), or both (if “both”)

  • hideAllTicks (bool) – (Optional) whether to hide ticks or not

  • norm (str) – (Optional) scale to use. Must either be ‘log’ or ‘linear’.

  • sizeFig ((int, int)) – (Optional) width and height of the figure

  • xlim ((float, float)) – (Optional) x-axis bounds. If None, the min and max of X are used.

  • ylim ((float, float)) – (Optional) y-axis bounds. If None, the min and max of Y are used.

Returns

current axis and plot

Raises

ValueError – if norm is neither ‘linear’, nor ‘log’