matplotlib / matplotlib/mplfinance
How can i avoid candles compression when placing horizontal lines?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 678
- PR merge metrics
- No merged PRs in 30d
Description
I've been using MPL finance for quite some time now, everything is flawless and i'm impressed by the new features!
I'm trying to fix a problem that has to do with Matplotlib itself too: once i add to my chart two horizontal lines that are far from the last price, the candles will get compressed and the chart becomes harder to read. Now i know that this happens because of the horizontal lines, but i was wondering if there is some way/method/function to scale the chart so that the candles stay less compressed while keeping the lines. Thanks in advance!
```
fig, axlist = mpf.plot(df, type='candle', figscale=2, figratio=(50, 50), style=s, returnfig=True)
ax1 = axlist[0]
ax1.axhline(8000)
ax1.axhline(14000)
```

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
No repository file or test is named. Start by reproducing the supplied mpf.plot example and inspect the relevant Matplotlib axis-scaling behavior; done would require a clearly defined, supported way to keep the horizontal lines while avoiding unreadable candle compression.
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
- Needs clarification
- Newbie friendliness
- 25/100