dlpy.timeseries.plot_timeseries¶
-
dlpy.timeseries.
plot_timeseries
(tbl, timeid, timeseries, figure=None, groupid=None, start_time=None, end_time=None, xlim=None, ylim=None, xlabel=None, ylabel=None, xdate_format=None, title=None, figsize=None, fontsize_spec=None, **kwargs)¶ Create a timeseries line plot from a CASTable or pandas DataFrame
Parameters: - tbl : CASTable or pandas.DataFrame or pandas.Series
The input table for the plot. If it is CASTable, it will be fetched to the client. If it is pandas.Series, the index name will become timeid, the series name will become timeseries.
- timeid : str
The name of the timeid variable. It will be the value to be used in the x-axis.
- timeseries : str
The name of the column contains the timeseries value. It will be the value to be used in the y-axis.
- figure : two-element-tuple, optional
The tuple must be in the form (matplotlib.figure.Figure, matplotlib.axes.Axes). These are the figure and axes that the user wants to plot on. It can be used to plot new timeseries plot on pre-existing figures.
Default: None- groupid : dict, optional
It is in the format {column1 : value1, column2 : value2, …}. It is used to plot subset of the data where column1 = value1 and column2 = value2, etc.
Default: None, which means do not subset the data.- start_time : datetime.datetime or datetime.date, optional
The start time of the plotted timeseries.
Default: None, which means the plot starts at the beginning of the timeseries.- end_time : datetime.datetime or datetime.date, optional
The end time of the plotted timeseries.
Default: None, which means the plot ends at the end of the timeseries.- xlim : tuple, optional
Set the data limits for the x-axis.
Default: None- ylim : tuple, optional
Set the data limits for the y-axis.
Default: None- xlabel : string, optional
Set the label for the x-axis.
- ylabel : string, optional
Set the label for the y-axis.
- xdate_format : string, optional
If the x-axis represents date or datetime, this is the date or datetime format string. (e.g. ‘%Y-%m-%d’ is the format of 2000-03-10, refer to documentation for datetime.datetime.strftime())
Default: None- title : string, optional
Set the title of the figure.
Default: None- figsize : tuple, optional
The size of the figure.
Default: None- fontsize_spec : dict, optional
It specifies the fontsize for ‘xlabel’, ‘ylabel’, ‘xtick’, ‘ytick’, ‘legend’ and ‘title’. (e.g. {‘xlabel’:14, ‘ylabel’:14}). If None, and figure is specified, then it will take from provided figure object. Otherwise, it will take the default fontsize, which are {‘xlabel’:16, ‘ylabel’:16, ‘xtick’:14, ‘ytick’:14, ‘legend’:14, ‘title’:20}
Default: None- `**kwargs` : keyword arguments, optional
Options to pass to matplotlib plotting method.
Returns: - (matplotlib.figure.Figure, matplotlib.axes.Axes)