matplotlib / matplotlib/mplfinance
Enhance hlines and alines
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 678
- PR merge metrics
- No merged PRs in 30d
Description
Hi Daniel,
first of all great compliments in advance. I'm always excited about what you bring in every release with this library for extensions.
Step by step I add each new function to the charts. Latest improvments are RSI in the middle, hlines and alines.
Currently I build up the alines and hlines as follows:
```
hlines = {}
hlines['values'] = swings_1
hlines['colors'] = ['lightgrey' for x in range(len(swings_1))]
hlines['linewidths'] = [1 for x in range(len(swings_1))]
hlines['values'] += swings_2
hlines['colors'] += ['grey' for x in range(len(swings_2))]
hlines['linewidths'] += [1 for x in range(len(swings_2))]
alines = list(zip(zip(df_breakout.d4_start, df_breakout.d4_high), zip(df_breakout.d4_end, df_breakout.d4_high)))
alines += list(zip(zip(df_breakout.d4_start, df_breakout.d4_low), zip(df_breakout.d4_end, df_breakout.d4_low)))
mpf.plot(df,
type='candle',
volume=True,
volume_panel = 2,
addplot=add_plots,
title=myfilename ,
ylabel='Kurs',
ylabel_lower='Volumen',
style=s,
figscale=3.0,
figratio=(18, 10),
datetime_format = '%d.%m.%y',
xrotation = 20,
hlines=
dict(hlines=hlines['values'], colors=hlines['colors'], linestyle='dashed', linewidths=hlines['linewidths']),
alines= alines,
savefig=save,
tight_layout=True,
closefig=True)
```
If i would like to use different colors and sizes, would it be possible to add a list of dicts in the future? Something like ...
`hlines = [dict_support_lines, dict_resistence_lines]`
... so that the other parameters (eg. linestyle) can also be changed more easily?

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the current hlines and alines handling in the mplfinance plotting API and review any existing examples or tests for these options. Define the supported grouped style dictionaries and confirm that colors, linewidths, and other line parameters can vary by group while existing input forms continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100