Kapla
October 8, 2021, 9:25pm
1
When I adding a vline to my graph it works perfect:
fig.add_vline(
x=pd.to_datetime('1970-01-01 00:00:00'),
line_dash='dot',
row=0)
But when I try adding an annotation text alongside the vline I get an error message
fig.add_vline(
x=pd.to_datetime('1970-01-01 00:00:00'),
line_dash='dot',
annotation_text='15',
row=0)
TypeError: Addition/subtraction of integers and integer-arrays with Timestamp is no longer supported. Instead of adding/subtracting n
, use n * obj.freq
3 Likes
I have this same issue!! :(((
Hello @bparzonz ,
Can you post your code so that we can see if we can figure out what is going on? Or something to at least get us in the ball park.
Hey thanks for the reply!
This is apparently an open issue still within plotly.
opened 05:08PM - 05 Feb 21 UTC
bug
Hi, I am trying to use the library for a simple visualisation for the first time⦠, and I stumbled upon supposedly a bug trying to draw a vertical line with text annotation on a graph with a date-time x axis.
```
import plotly.express as px
df = px.data.stocks(indexed=True)
fig = px.line(df)
fig.add_vline(x="2018-09-24", annotation_text="test" )
fig.show()
```
I get the following error message:
`TypeError: unsupported operand type(s) for +: 'int' and 'str'`
Could anyone please help me confirm that it is indeed a bug, my version is '4.14.1' ? Thank you.
There is a workaround, but an actual fix doesnβt appear to be moving very quickly
Are you using categories?
It didnt seem to be too difficult to use in the example that they had put. I also have an interface where it gives me an error saying it expects the x value to be a float or an int.
Nope! I was able to use the workaround just fine, it just required a little extra legwork because I wasnβt using timestamps, I was using datetimes.