matplotlib / matplotlib/mplfinance

How to add Horizontal Line in make_addplot? make_addplot(rsi,panel='lower',color='g',hlines=[20,80])

Open
#140 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement question
Dominant language
Python
Stars
4.4k
Forks
678
PR merge metrics
No merged PRs in 30d

Description

I have this code.

```python
apds = [mpf.make_addplot(buy_signal,scatter=True,markersize=100,marker='^'),
mpf.make_addplot(sell_signal,scatter=True,markersize=100,marker='v'),
mpf.make_addplot(close_signal,scatter=True,markersize=100,marker='o'),
mpf.make_addplot(rsi,panel='lower',color='g',hlines=[20,80])

mpf.plot(self.df,addplot=apds,figscale=2,volume=False,type = type,
title= str(self.info)
)

```
I want to put a horizontal line for my RSI. But there is a kwargs error which says hline is not found.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the make_addplot entry point and how its keyword arguments are handled before mpf.plot renders the lower panel. Confirm how an RSI panel can receive horizontal levels at 20 and 80, then verify that the example runs without the unknown-kwarg error and displays both lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.