pecos.graphics module

The graphics module contains functions to format scatter and time series plots for reporting.

pecos.graphics.plot_scatter(x, y, xaxis_min=None, xaxis_max=None, yaxis_min=None, yaxis_max=None)[source]

Create a scatter plot. If x and y have the same number of columns, then the columns of x are plotted against the corresponding columns of y, in order. If x (or y) has 1 column, then that column of data is plotted against all the columns in y (or x).

Parameters:

x : pd.DataFrame

x data

y : pd.DataFrame

y data

xaxis_min : float (optional)

X-axis minimum

xaxis_max : float (optional)

X-axis maximum

yaxis_min : float (optional)

Y-axis minimum

yaxis_max : float (optional)

Y-axis maximum

pecos.graphics.plot_timeseries(data, tfilter=None, test_results_group=None, xaxis_min=None, xaxis_max=None, yaxis_min=None, yaxis_max=None)[source]

Create a time series plot using each column in the DataFrame.

Parameters:

data : pd.DataFrame

Data, indexed by time

tfilter : pd.Series (optional)

Boolean values used to include time filter in the plot

test_results_group : pd.DataFrame (optional)

Test results for a particular variable. To group test results by variable, use grouped = pm.test_results.groupby([‘System Name’, ‘Variable Name’]).

xaxis_min : float (optional)

X-axis minimum

xaxis_max : float (optional)

X-axis maximum

yaxis_min : float (optional)

Y-axis minimum

yaxis_max : float (optional)

Y-axis maximum

pecos.graphics.plot_colorblock(values, vmin=0, vmax=1, nColors=12, colors=[(0.75, 0.15, 0.15), (1, 0.75, 0.15), (0.15, 0.75, 0.15)])[source]

Create a colorblock figure. Default color scheme is red to yellow to green with 12 colors. This function can be used to generate dashboards with simple color indicators in each cell.

Parameters:

values : 2D np.array

Values to plot in the colorblock

vmin : float (optional)

Colomap minimum, default = 0

vmax : float (optional)

Colomap maximum, default = 1

num_colors : int (optional)

Number of colors in the colormap

colors : list (optional)

List of colors, colors can be specified in any way understandable by matplotlib.colors.ColorConverter.to_rgb(). Default is red to yellow to green.

pecos.graphics.plot_test_results(filename_root, pm, image_format='png', dpi=500, figsize=(7.0, 2.5))[source]

Create test results graphics which highlight data points that failed a quality control test.

Parameters:

filename : string

Filename root, with full path. Each grpahics filename is appended with an integer. For example, filename_root = ‘C:\pecos\results\test’ will generate a file named ‘C:\pecos\results\test1.png’. The directory ‘’C:\pecos\results’ must exist.

pm : PerformanceMonitoring object

Contains data (pm.df) and test results (pm.test_results)

image_format : string (optional)

Image format, default = ‘png’