Skip to content

plot horizontal lines without time #284

Answered by highfestiva
nqnga asked this question in Q&A
Discussion options

You must be logged in to vote

See examples/line.py for how to draw lines, or examples/btc-long-term.py for how to draw a bunch of vertical lines. If you want future dates in your charts, you need to set your timestamps accordingly to the time to want to predict for. Something like:

plt
import numpy as np
import pandas as pd

dates = pd.date_range('2022-01-01', '2022-06-01', freq='1d') # future dates
prices = pd.Series(np.sin(dates.view(float)*1e199))
fplt.plot(dates, prices, width=3) # plot some price chart

# project some lines
for i in range(0, len(dates)-20, 20):
    d0 = dates[i]
    d1 = dates[i+20]
    p0 = prices[i]
    p1 = prices[i+5]
    fplt.add_line((d0, p0), (d1, p1))

fplt.show()

GL!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nqnga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants