geocat.viz.Contour

class geocat.viz.Contour(*args, **kwargs)

Create contour plot.

Parameters

data (xarray.DataArray or numpy.ndarray) – The dataset to plot. If inputted as a Xarray file, titles and labels will be automatically inferred.

Keyword Arguments
  • contour_fill (bool) – Whether filled contours will be drawn. Default True.

  • contour_lines (bool) – Whether contours lines will be drawn. Default True.

  • contour_label_background (bool) – Whether a white background for the contour labels will be drawn. Default False.

  • contour_label_fontsize (int) – Font size of the contour line labels. Default 12.

  • contour_label_box (bool) – Whether to draw a box stating contour levels in right hand corner. Default False unless plot has no filled contours and has a projection.

  • contour_labels (list or numpy.ndarray) – List or array of labels to use for contour line labels.

  • draw_contour_labels (bool) – Whether add contour line labels to the figure.

  • levels (list or numpy.ndarray) – List or array of levels to be passed into matplotlib’s contour and/or contourf function.

Note

All other keyword args will be passed to NCL_Plot. To see NCL_Plot.

Returns

Contour_Object – A contour plot with specified input style.

Return type

contourf.Contour

Methods

__init__(*args, **kwargs)

Create contour figure.

add_colorbar([mappable, cb_orientation, ...])

Add colorbar to figure.

add_contour_labels([ax, lines, ...])

Add contour line labels with an optional white background to the figure.

add_titles([main_title, ...])

Add titles to figure.

get_mpl_obj()

Get matplotlib object.

savefig(filepath)

Save figure.

show()

Display the plot.

show_coastline([scale, lw, ec])

Add coastlines to figure.

show_lakes([scale, lw, ec, fc])

Add lakes to figure.

show_land([scale, fc])

Add land to figure.

add_contour_labels(ax=None, lines=None, contour_labels=None, background=None, fontsize=12)

Add contour line labels with an optional white background to the figure.

Parameters
Keyword Arguments
  • contour_label_background (bool) – Whether a white background for the contour labels will be drawn. Default False.

  • contour_label_fontsize (int) – Font size of the contour line labels. Default 12.

  • contour_labels (list or numpy.ndarray) – List or array of labels to use for contour line labels.

  • draw_contour_labels (bool) – Whether add contour line labels to the figure.