matplotlib / matplotlib/mplfinance

`vlines` (vertical lines, sharing x axis) on multiple panels

Open
#513 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello Daniel, 👋

Thank you for your dedication in improving the MPF library ! 📈
I am looking for different options for the X_AXIS/GRID adjustments:

  • [1] : Drawing vertical line for all panels ( when passing **kwargs(vlines) to mpf.plot() it is not drawing on all panels)

  • [2] : Adjusting the grid for x_axis with MPF. I seen other examples where we have to use axes . Is there a more efficient way to do that with MPF?

If i well understood what others did is, returning the axes and then calling the add_subplot method from MPL wich will force me to start again from scratch using only MPL.

I guess I missed something, here is a part of my code:


df = 'pandas dataframe with datetime index and ohlcv and RSI values'
vls = pd.date_range(df.index.min(), df.index.max(), freq='D').tolist()

ap1 = [
    mpf.make_addplot(df['RSI'], panel=1, color='royalblue')
    ] 

kwargs = dict(type='candle', vlines=dict(vlines=vls, linewidths=0.5, colors=('r')))
mpf.plot(df, addplot=ap1, **kwargs)

(If you prefer 2 different posts i can separate each request..)

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 from the provided mpf.plot() example using addplot, vlines, and a pandas datetime index, then inspect how vertical lines and x-axis grid settings are applied across panels. Done means vertical lines appear on all panels and the x-axis grid can be adjusted through MPF without rebuilding the chart with Matplotlib.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, pandas, python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.