sensortoolkit.plotting._timeseries.sensor_timeplot

sensor_timeplot(df_list, ref_df, param=None, sensor_name=None, figure_path=None, bdate=None, edate=None, write_to_file=True, sensor_serials=None, ref_name=None, averaging_interval=None, return_mpl_obj=True, report_fmt=False, ax=None, fig=None, **kwargs)[source]

Generate a timeplot for a specified pollutant alongside FRM/FEM concentration values.

Parameters
  • df_list (list) – List of Pandas dataframes containing sensor data.

  • ref_df (pandas DataFrame) – Reference dataset.

  • param (str, optional) – Column header name for the pollutant values to be plotted. Defaults to None.

  • sensor_name (str, optional) – Unformatted sensor name, passed to Formatted_Sensor_Name() for including formatted version on plot. Defaults to None.

  • figure_path (str, optional) – Path to directory where the figure will be saved. Defaults to None.

  • bdate (str, optional) – Date (‘yyyy-mm-dd’ format) for beginning of timeseries plot. Defaults to None.

  • edate (str, optional) – Date (‘yyyy-mm-dd’ format) for end of timeseries plot. Defaults to None.

  • write_to_file (bool, optional) – If true, figure is written to file and interactive plot is closed. Defaults to True.

  • sensor_serials (dict, optional) – Optional pass sensor serials dictionary to plot sensor serial IDs in the legend instead of numbered sensors. Defaults to None.

  • ref_name (str, optional) – The name of the FRM/FEM monitor (make and model). Defaults to None.

  • averaging_interval (str, optional) – The measurement averaging intervals commonly utilized for analyzing data corresponding the the selected parameter. Defaults to None.

  • return_mpl_obj (bool, optional) – If true, will return a Matplotlib axes instance (useful for iteration over subplot axes if this plotting function is called within a for-loop that is iterating over the axes elements in a Matplotlib subplot object). Defaults to True.

  • report_fmt (bool, optional) – If true, select formatting presets for displaying figures on the reporting template for sensor performance evaluations included alongside US EPA’s performance targets documents for air sensors. Defaults to False.

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – Optional, the Matplotlib Axes object on which plotting elements will be drawn. Useful is the user is iterating over the Axes elements of a Matplotlib figure in a for-loop outside this plotting function. Within the loop, calls to this function can be made to add elements for each axes object. Defaults to None.

  • fig (Matplotlib.figure.Figure, optional) – Optional, the Matplotlib figure on which axes object elements are drawn. Useful is the user is iterating over the Axes elements of a Matplotlib figure in a for-loop outside this plotting function. Within the loop, calls to this function can be made to add elements for each axes object. Defaults to None.

Keyword Arguments:

Parameters
  • seaborn_style (str) – The plotting style based on seaborn’s style options. Defaults to ‘darkgrid’. Values must be a valid seaborn style name.

  • date_interval (int) – Number of days between x-axis tick marks with ‘mm-dd-yy’ timestamps.

  • yscale (str) – The scaling for the y-axis. Accepted values include ‘linear’, ‘log’, ‘symlog’, ‘logit’, etc.

  • ylims (Two-element tuple of floats or ints) – Set the y-limits of the plot.

  • format_xaxis_weeks (bool) – Plot the timeseries x-axis (time) in increments of 1 week. Defaults to False.

  • fig_size (Two-element tuple) – The dimensions (width, height) in inches of the Matplotlib figure to be drawn. Defaults to (16, 3.5).

  • float (fontsize int or) – The font size for the xlabel, ylabel, and plot text. Passed on to Draw_Scatter() which uses 0.85*font_size for tick labels.

  • legend_fontscale (font) – Relative scale of fontsize for text in the legend relative to label text.

  • cmap_name (str) – The name of the Matplotlib colormap that will be used when drawing plot elements. Defaults to 'Set1'. A full list of colormaps is can be found in the Matplotlib documentation

  • cmap_normrange (Two-element tuple) – Normalized range (0,1) for colormap hue selection. Limiting this range to something like (0.1, 0.9) is useful when using colormaps with high contrast extrema and a gradual change in hue is desired for plots.

  • show_title (bool) – If true, display the title for the figure. Defaults to True.

  • filename_suffix (str) – Optional string added to end of filename. Defaults to empty string.

  • box_xscale (float) – Scalar value for translating the x-coordinates of the Matplotlib axes object box in which the plot is drawn. Passed to the Matplotlib.Axes.set_position() method for adjusting the axes box dimensions relative to the Matplotlib figure coordinates.

  • box_yscale (float) – Scalar value for translating the y-coordinates of the Matplotlib axes object box in which the plot is drawn. Passed to the Matplotlib.Axes.set_position() method for adjusting the axes box dimensions relative to the Matplotlib figure coordinates.

  • box_wscale (float) – Scalar value for transforming the x-range (width) of the Matplotlib axes object box in which the plot is drawn. Passed to the Matplotlib.Axes.set_position() method for adjusting the axes box dimensions relative to the Matplotlib figure coordinates.

  • box_hscale (float) – Scalar value for transforming the y-range (height) of the Matplotlib axes object box in which the plot is drawn. Passed to the Matplotlib.Axes.set_position() method for adjusting the axes box dimensions relative to the Matplotlib figure coordinates.

  • legend_loc (Two-element tuple) – The x and y coordinate of center of the legend (relative to the axes object coordinates).

  • sensor_colors (list) – Set the list of colors for drawing sensor line plots. Default set by chosen colormap (cmap_name) and the normalized range for the colormap.

  • sensor_linealpha (float) – The transparency of the lines indicating sensor measurements. Defaults to 0.70.

  • sensor_linewidth (float) – The width (thickness) of the lines indicating sensor measurements. Defaults to 1.5.

  • sensor_linestyle (str) – The style of the lines indicating sensor measurements. Passed to matplotlib linestyles. Defaults to ‘-‘.

  • ref_linecolor (str) – The color of the line indicating reference measurements. Defaults to ‘k’.

  • ref_linealpha (float) – The transparency of the line indicating reference measurements. Defaults to 0.97.

  • ref_linewidth (float) – The width (thickness) of the line indicating reference measurements. Defaults to 1.5.

  • ref_linestyle (str) – The style of the lines indicating reference measurements. Passed to matplotlib linestyles. Defaults to ‘-‘.

  • date_format (str) – The strftime format in which dates will be displayed along the x-axis if ‘format_xaxis_weeks’ is False. Defaults to “%m-%d-%y”.

  • legend_fontsize (float) – Value by which to scale the legend text font size relative to the value of the fontsize argument. Defaults to 0.72.

  • subplots_adjust (Four-element tuple.) – Modify the bounds of the subplot [x-min, x-max, y-max, y-min]. If unique_ax_obj is True, defaults to (0.05, 0.9, 0.90, 0.15).

Returns

If return_mpl_obj is True or report_fmt is True, return ax object, else return None.

Return type

ax (matplotlib axes object)