1

I know it may sound too simple but it got me stuck! I have a candle stick chart using fplt and I simply want to add a horizontal line to it but not sure how!

ax = fplt.plot(
                result,
                type='candle',
                style = 'charles',
                title='whatever!',
                ylabel='anything',figsize=(24,8)
            )

this creates my candle chart pretty well and nice as I wanted! but then I use ax.axhline(...) but gives me error or I use ax.plt(x_coordinates,y_coordinates) but again error: 'NoneType' object has no attribute 'plt'

can someone please make my life easier?! I just want to add a horizontal line here! thanks

Vincer
  • 33
  • 1
  • 7
  • As a general rule, you should indicate in SO questions what you have done to try to solve your question. You have not indicate that you have tried anything. Simply googling "mplfinance horizontal line" will show you the answer. – Daniel Goldfarb Jul 26 '21 at 20:48

2 Answers2

4

With mplfinance, this is as simple as reading the mplfinance documentation, specifically the section titled Trends, Support, Resistance, and Trading Lines

You can see there this is as simple as using the hlines kwarg:

Also, mpf.plot() (or as you have unconventionally written, fplt.plot()) returns None, unless you set kwarg returnfig=True, but for what you want to do, there is no reason to access the Figure or Axes objects.

hth

Daniel Goldfarb
  • 6,937
  • 5
  • 29
  • 61
1

Briefly reading the intro https://pypi.org/project/finplot/ it looks like fplt.plot returns None (which you then assign to ax) and you should get the axis from fplt.create_plot()

ti7
  • 16,375
  • 6
  • 40
  • 68
  • Sorry I was not clear, fplt is mplfinance module not finplot. For some reason I have problems installing finplot (issues with the version and dll file ...) – Vincer Jul 26 '21 at 20:06