Plotter Module

class plotter.TaylorDiagram(refstd, radmax=1.5, fig=None, rect=111, label='_')

Taylor diagram helper class

Plot model standard deviation and correlation to reference (data) sample in a single-quadrant polar plot, with r=stddev and theta=arccos(correlation).

Set up Taylor diagram axes, i.e. single quadrant polar plot, using mpl_toolkits.axisartist.floating_axes. refstd is the reference standard deviation to be compared to.

add_contours(std1, corr1, std2, corr2, **kwargs)

Add a line between two points [std1, corr1] and [std2, corr2]

add_rms_contours(levels=5, **kwargs)

Add constant centered RMS difference contours.

add_sample(stddev, corrcoef, *args, **kwargs)

Add sample (stddev,corrcoeff) to the Taylor diagram. args and kwargs are directly propagated to the Figure.plot command.

add_stddev_contours(std, corr1, corr2, **kwargs)

Add a curved line with a radius of std between two points [std, corr1] and [std, corr2]

plotter.draw_contour_map(dataset, lats, lons, fname, fmt='png', gridshape=(1, 1), clabel='', ptitle='', subtitles=None, cmap=None, clevs=None, nlevs=10, parallels=None, meridians=None, extend='neither', aspect=3.4)
Purpose::
Create a multiple panel contour map plot.
Input::

dataset - 3d array of the field to be plotted with shape (nT, nLon, nLat) lats - array of latitudes lons - array of longitudes fname - a string specifying the filename of the plot fmt - an optional string specifying the filetype, default is .png gridshape - optional tuple denoting the desired grid shape (nrows, ncols) for arranging

the subplots.

clabel - an optional string specifying the colorbar title ptitle - an optional string specifying plot title subtitles - an optional list of strings specifying the title for each subplot cmap - an string or optional matplotlib.colors.LinearSegmentedColormap instance

denoting the colormap

clevs - an optional list of ints or floats specifying contour levels nlevs - an optional integer specifying the target number of contour levels if

clevs is None

parallels - an optional list of ints or floats for the parallels to be drawn meridians - an optional list of ints or floats for the meridians to be drawn extend - an optional string to toggle whether to place arrows at the colorbar

boundaries. Default is ‘neither’, but can also be ‘min’, ‘max’, or ‘both’. Will be automatically set to ‘both’ if clevs is None.
plotter.draw_portrait_diagram(results, rowlabels, collabels, fname, fmt='png', gridshape=(1, 1), xlabel='', ylabel='', clabel='', ptitle='', subtitles=None, cmap=None, clevs=None, nlevs=10, extend='neither', aspect=None)
Purpose::
Makes a portrait diagram plot.
Input::
results - 3d array of the field to be plotted. The second dimension
should correspond to the number of rows in the diagram and the third should correspond to the number of columns.

rowlabels - a list of strings denoting labels for each row collabels - a list of strings denoting labels for each column fname - a string specifying the filename of the plot fmt - an optional string specifying the output filetype gridshape - optional tuple denoting the desired grid shape (nrows, ncols) for arranging

the subplots.

xlabel - an optional string specifying the x-axis title ylabel - an optional string specifying the y-axis title clabel - an optional string specifying the colorbar title ptitle - a string specifying the plot title subtitles - an optional list of strings specifying the title for each subplot cmap - an optional string or matplotlib.colors.LinearSegmentedColormap instance

denoting the colormap

clevs - an optional list of ints or floats specifying colorbar levels nlevs - an optional integer specifying the target number of contour levels if

clevs is None
extend - an optional string to toggle whether to place arrows at the colorbar
boundaries. Default is ‘neither’, but can also be ‘min’, ‘max’, or ‘both’. Will be automatically set to ‘both’ if clevs is None.
aspect - Float denoting approximate aspect ratio of each subplot
(width / height). Default is 8.5 / 5.5
plotter.draw_subregions(subregions, lats, lons, fname, fmt='png', ptitle='', parallels=None, meridians=None, subregion_masks=None)
Purpose::
Function to draw subregion domain(s) on a map
Input::

subregions - a list of subRegion objects lats - array of latitudes lons - array of longitudes fname - a string specifying the filename of the plot fmt - an optional string specifying the filetype, default is .png ptitle - an optional string specifying plot title parallels - an optional list of ints or floats for the parallels to be drawn meridians - an optional list of ints or floats for the meridians to be drawn subregion_masks - optional dictionary of boolean arrays for each subRegion

for giving finer control of the domain to be drawn, by default the entire domain is drawn.
plotter.draw_taylor_diagram(results, names, refname, fname, fmt='png', gridshape=(1, 1), ptitle='', subtitles=None, pos='upper right', frameon=True, radmax=1.5)
Purpose::
Draws a Taylor diagram
Input::
results - an Nx2 array containing normalized standard deviations,
correlation coefficients, and names of evaluation results

names - list of names for each evaluated dataset refname - The name of the reference dataset fname - a string specifying the filename of the plot fmt - an optional string specifying the filetype, default is .png gridshape - optional tuple denoting the desired grid shape (nrows, ncols) for arranging

the subplots.

ptitle - an optional string specifying the plot title subtitles - an optional list of strings specifying the title for each subplot pos - an optional string or tuple of float for determining

the position of the legend
frameon - an optional boolean that determines whether to draw a frame
around the legend box
radmax - an optional float to adjust the extent of the axes in terms of
standard deviation.
plotter.draw_time_series(results, times, labels, fname, fmt='png', gridshape=(1, 1), xlabel='', ylabel='', ptitle='', subtitles=None, label_month=False, yscale='linear', aspect=None)
Purpose::
Function to draw a time series plot
Input::

results - a 3d array of time series times - a list of python datetime objects labels - a list of strings with the names of each set of data fname - a string specifying the filename of the plot fmt - an optional string specifying the output filetype gridshape - optional tuple denoting the desired grid shape (nrows, ncols) for arranging

the subplots.

xlabel - a string specifying the x-axis title ylabel - a string specifying the y-axis title ptitle - a string specifying the plot title subtitles - an optional list of strings specifying the title for each subplot label_month - optional bool to toggle drawing month labels yscale - optional string for setting the y-axis scale, ‘linear’ for linear

and ‘log’ for log base 10.
aspect - Float denoting approximate aspect ratio of each subplot
(width / height). Default is 8.5 / 5.5
plotter.set_cmap(name)

Sets the default colormap (eg when setting cmap=None in a function) See: http://matplotlib.org/examples/pylab_examples/show_colormaps.html for a list of possible colormaps. Appending ‘_r’ to a matplotlib colormap name will give you a reversed version of it.

Parameters:name (str) – The name of the colormap.

Previous topic

Metrics Module

Next topic

Data Sources

This Page