Hi there and thanks for this nice graphing library! It works very nice for me! See code below: Using add_vline + annotation_text however seems not to work on a dataframe using a DateTimeIndex: āunsupported operand type(s) for +: āintā and āstrāā.
Am I doing something wrong? Or is this a bug? If so: Where can I report the bug? I am using version 4.14.3
import os
import pandas as pd
import numpy as np
import plotly.express as px
working_dir = os.path.dirname(os.path.abspath(__file__))
# Normal Index: vline and annotation okay
rng = pd.date_range('2015-02-24', periods=5, freq='T')
df = pd.DataFrame({ 'Date': rng, 'Val': np.random.randn(len(rng)) })
fig = px.line(df, x=df.index, y='Val')
fig.add_vline(1, line_dash="dash", annotation_text="Test")
fig.write_html(working_dir+r"\test_vline_1.html")
# Datetime-Index: vline without annotation okay
rng = pd.date_range('2015-02-24', periods=5, freq='T')
df = pd.DataFrame({ 'Val' : np.random.randn(len(rng)) }, index=rng)
fig = px.line(df, x=df.index, y='Val')
fig.add_vline('2015-02-24 00:01:00')
fig.write_html(working_dir+r"\test_vline_2.html")
# Datetime-Index: vline with annotation triggers an error
rng = pd.date_range('2015-02-24', periods=5, freq='T')
df = pd.DataFrame({ 'Val' : np.random.randn(len(rng)) }, index=rng)
fig = px.line(df, x=df.index, y='Val')
fig.add_vline('2015-02-24 00:01:00', annotation_text="Test")
fig.write_html(working_dir+r"\test_vline_3.html")