metobs_toolkit.Dataset.make_plot#

Dataset.make_plot(stationnames=None, obstype='temp', colorby='name', starttime=None, endtime=None, title=None, y_label=None, legend=True, show_outliers=True, show_filled=True, _ax=None)[source]#

This function creates a timeseries plot for the dataset. The variable observation type is plotted for all stationnames from a starttime to an endtime.

All styling attributes are extracted from the Settings.

Parameters:
  • stationnames (list, optional) – A list with stationnames to include in the timeseries. If None is given, all the stations are used, defaults to None.

  • obstype (string, optional) – Fieldname to visualise. This can be an observation or station attribute. The default is ‘temp’.

  • colorby ('label' or 'name', optional) – Indicate how colors should be assigned to the lines. ‘label’ will color the lines by their quality control label. ‘name’ will color by each station, defaults to ‘name’.

  • starttime (datetime.datetime, optional) – Specifiy the start datetime for the plot. If None is given it will use the start datetime of the dataset, defaults to None.

  • endtime (datetime.datetime, optional) – Specifiy the end datetime for the plot. If None is given it will use the end datetime of the dataset, defaults to None.

  • title (string, optional) – Title of the figure, if None a default title is generated. The default is None.

  • y_label (string, optional) – y-axes label of the figure, if None a default label is generated. The default is None.

  • legend (bool, optional) – If True, a legend is added to the plot. The default is True.

  • show_outliers (bool, optional) – If true the observations labeld as outliers will be included in the plot. This is only true when colorby == ‘name’. The default is True.

  • show_filled (bool, optional) – If true the filled values for gaps and missing observations will be included in the plot. This is only true when colorby == ‘name’. The default is True.

Returns:

axis – The timeseries axes of the plot is returned.

Return type:

matplotlib.pyplot.axes

Note

If a timezone unaware datetime is given as an argument, it is interpreted as if it has the same timezone as the observations.

Examples

>>> import metobs_toolkit
>>>
>>> # Import data into a Dataset
>>> dataset = metobs_toolkit.Dataset()
>>> dataset.update_settings(
...                         input_data_file=metobs_toolkit.demo_datafile,
...                         input_metadata_file=metobs_toolkit.demo_metadatafile,
...                         template_file=metobs_toolkit.demo_template,
...                         )
>>> dataset.import_data_from_file()
>>>
>>> # Make plot
>>> dataset.make_plot(stationnames=['vlinder02', 'vlinder16'],
...                   obstype='temp',
...                   colorby='label')
<Axes: ...