mpas_analysis.shared.plot.plot_vertical_section
- mpas_analysis.shared.plot.plot_vertical_section(config, field, colorMapSectionName, xCoords=None, zCoord=None, suffix='', colorbarLabel=None, title=None, xlabels=None, ylabel=None, figsize=(10, 4), dpi=None, titleFontSize=None, defaultFontSize=None, titleY=None, axisFontSize=None, xLim=None, yLim=None, lineWidth=2, lineStyle='solid', lineColor='black', contourColormap=None, backgroundColor='grey', invalidColor='white', outlineValid=True, numUpperTicks=None, upperXAxisTickLabelPrecision=None, invertYAxis=True, xCoordIsTime=False, movingAveragePoints=None, firstYearXTicks=None, yearStrideXTicks=None, maxXTicks=20, calendar='gregorian', plotAsContours=False, contourComparisonField=None, comparisonFieldName=None, originalFieldName=None, comparisonContourLineWidth=None, comparisonContourLineStyle=None, comparisonContourLineColor=None, labelContours=False, contourLabelPrecision=1, maxTitleLength=None)[source]
- Plots a data set as a x distance (latitude, longitude, or spherical distance) vs depth map (vertical section). - Or, if xCoordIsTime is True, plots data set on a vertical Hovmoller plot (depth vs. time). - Typically, the - fielddata are plotted using a heatmap, but if- contourComparisonFieldis not None, then contours of both- fieldand- contourComparisonFieldare plotted instead.- Parameters:
- config (instance of ConfigParser) – the configuration, containing a [plot] section with options that control plotting 
- field (xarray.DataArray) – field array to plot. For contour plots, - xCoordsand- zCoordsshould broadcast to the same shape as- field. For heatmap plots,- xCoordsand- zCoordsare the corners of the plot. If they broadcast to the same shape as- field,- fieldwill be bilinearly interpolated to center values for each plot cell. If the coordinates have one extra element in each direction than- field,- fieldis assumed to contain cell values and no interpolation is performed.
- colorMapSectionName (str) – section name in - configwhere color map info can be found.
- xCoords (xarray.DataArray or list of xarray.DataArray, optional) – The x coordinate(s) for the - field. Optional second and third entries will be used for a second and third x axis above the plot. The typical use for the second and third axis is for transects, for which the primary x axis represents distance along a transect, and the second and third x axes are used to display the corresponding latitudes and longitudes.
- zCoord (xarray.DataArray, optional) – The z coordinates for the - field
- suffix (str, optional) – the suffix used for colorbar config options 
- colorbarLabel (str, optional) – the label for the colorbar. If plotAsContours and labelContours are both True, colorbarLabel is used as follows (typically in order to indicate the units that are associated with the contour labels): if - contourComparisonFieldis None, the- colorbarLabelstring is parenthetically appended to the plot title; if- contourComparisonFieldis not None, it is parenthetically appended to the legend entries of the contour comparison plot.
- title (str, optional) – title of plot 
- xlabels (str or list of str, optional) – labels of x-axes. Labels correspond to entries in - xCoords.
- ylabel (str, optional) – label of y-axis 
- figsize (tuple of float, optional) – size of the figure in inches, or None if the current figure should be used (e.g. if this is a subplot) 
- dpi (int, optional) – the number of dots per inch of the figure, taken from section - plotoption- dpiin the config file by default
- titleFontSize (int, optional) – size of the title font 
- defaultFontSize (int, optional) – the size of text other than the title 
- titleY (float, optional) – the y value to use for placing the plot title 
- axisFontSize (int, optional) – size of the axis font 
- xLim (float array, optional) – x range of plot 
- yLim (float array, optional) – y range of plot 
- lineWidth (float, optional) – the line width of contour lines (if specified) 
- lineStyle (str, optional) – the line style of contour lines (if specified); this applies to the style of contour lines of fieldArray (the style of the contour lines of contourComparisonField is set using contourComparisonLineStyle). 
- lineColor (str, optional) – the color of contour lines (if specified); this applies to the contour lines of fieldArray (the color of the contour lines of contourComparisonField is set using contourComparisonLineColor 
- backgroundColor (str, optional) – the background color for the plot outside the limits of - xCoordand- zCoord.
- invalidColor (str, optional) – the color for invalid values (NaNs and masked areas will be shown in this color) 
- outlineValid (bool, optional) – whether to outline the boundary between the valid an invalid regions with a black contour 
- numUpperTicks (int, optional) – the approximate number of ticks to use on the upper x axis or axes (these are the second and third x axes, which are placed above the plot if they have been requested by specifying the secondXAxisData or thirdXAxisData arrays above) 
- upperXAxisTickLabelPrecision (int, optional) – the number of decimal places (to the right of the decimal point) to use for values at upper axis ticks. This value can be adjusted (in concert with numUpperTicks) to avoid problems with overlapping numbers along the upper axis. 
- invertYAxis (logical, optional) – if True, invert Y axis 
- xCoordIsTime (logical, optional) – if True, format the x axis for time (this applies only to the primary x axis, not to the optional second or third x axes) 
- movingAveragePoints (int, optional) – the number of points over which to perform a moving average NOTE: this option is mostly intended for use when - xCoordIsTimeis True, although it will work with other data as well. Also, the moving average calculation is based on number of points, not actual x axis values, so for best results, the values in the first entry in- xCoordsshould be equally spaced.
- firstYearXTicks (int, optional) – The year of the first tick on the x axis. By default, the first time entry is the first tick. 
- yearStrideXTicks (int, optional) – The number of years between x ticks. By default, the stride is chosen automatically to have - maxXTickstick marks or fewer.
- maxXTicks (int, optional) – the maximum number of tick marks that will be allowed along the primary x axis. This may need to be adjusted depending on the figure size and aspect ratio. NOTE: maxXTicks is only used if xCoordIsTime is True 
- calendar (str, optional) – the calendar to use for formatting the time axis NOTE: calendar is only used if xCoordIsTime is True 
- plotAsContours (bool, optional) – if plotAsContours is True, instead of plotting - fieldas a heatmap, the function will plot only the contours of- field. In addition, if contourComparisonField is not None, the contours of this field will be plotted on the same plot. The selection of contour levels is still determined as for the contours on the heatmap plots, via the ‘contours’ entry in- colorMapSectionName.
- contourComparisonField (float array, optional) – a comparison - fieldarray (typically observational data or results from another simulation run), assumed to be of the same shape as- field. If- plotAsContoursis- Trueand- countourComparisonFieldArrayis not- None, then contours of both- fieldand- contourComparisonFieldwill be plotted in order to enable a comparison of the two fields on the same plot.
- comparisonFieldName (str, optional) – the name for the comparison field. If contourComparisonField is None, this parameter is ignored. 
- originalFieldName (str, optional) – the name for the - fieldfield (for the purposes of labeling the contours on a contour comparison plot). If contourComparisonField is None, this parameter is ignored.
- comparisonContourLineWidth (float, optional) – the line width of contour lines of the comparisonFieldName field on a contour comparison plot 
- comparisonContourLineStyle (str, optional) – the line style of contour lines of the comparisonFieldName field on a contour comparison plot 
- comparisonContourLineColor (str, optional) – the line color of contour lines of the comparisonFieldName field on a contour comparison plot 
- labelContours (bool, optional) – whether or not to label contour lines (if specified) with their values 
- contourLabelPrecision (int, optional) – the precision (in terms of number of figures to the right of the decimal point) of contour labels 
- maxTitleLength (int or None, optional) – the maximum number of characters in the title, beyond which it is truncated with a trailing ellipsis. The default is from the - maxTitleLengthconfig option.
 
- Returns:
- fig ( - matplotlib.figure.Figure) – The figure that was plotted
- ax ( - matplotlib.axes.Axes) – The subplot