emrpy.visualization

emrpy.visualization.plot_timeseries(df, timestamp_col='timestamp', value_col='close', segment_col=None, segment_value=None, tick_every=100, figsize=(12, 6), save_path=None)

Plot time series data with continuous bar numbering to avoid trading gaps.

This function creates a continuous plot by using bar numbers instead of timestamps, which eliminates gaps from weekends and holidays in financial data.

Return type:

None

Parameters:

dfpd.DataFrame

DataFrame containing the time series data

timestamp_colstr, default ‘timestamp’

Name of the timestamp column

value_colstr, default ‘close’

Name of the column containing values to plot

segment_colstr, optional

Column name to filter by (e.g., ‘Symbol’ for stock tickers)

segment_valuestr, optional

Value to filter on in segment_col (e.g., ‘AAPL’)

tick_everyint, default 100

Show timestamp labels every N bars

figsizetuple, default (12, 6)

Figure size as (width, height)

Examples:

>>> # Plot AAPL data
>>> plot_timeseries(
...     df=stock_data,
...     segment_col='Symbol',
...     segment_value='AAPL'
... )
>>> # Plot all data without filtering
>>> plot_timeseries(df=price_data)

Modules

finance

timeseries

Time Series Visualization Utilities