matplotlib / matplotlib/mplfinance

how to extend the y-axis?

Open
#598 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Perhaps the best way to explain this problem is by the picture below. As you can see, there are three blue lines drawn, but the top line is out of plot. How can I extend the y-axis on the graph so that the top line is fully visible?

![mpf-problem margins](https://user-images.githubusercontent.com/94080584/224735596-f5563bef-f536-40ea-8e1f-96e71e4b7feb.png)

This code below created the plot:
```python
fig, axlist = mpf.plot(data[start_date:end_date], figratio=(20,12),
type='candle',
alines=seq_of_seq_of_points,
volume=True,
tight_layout=True,
style='yahoo',
addplot=apd,
returnfig=True)

fig.suptitle("SPY", y=1.05, fontsize=30, x=0.59)
```

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 at the mpf.plot call shown in the issue and inspect how its y-axis limits, margins, and tight_layout handling affect the alines. Check the returned fig and axlist alongside fig.suptitle to determine where the top line is clipped. Done means the plotted line is fully visible without breaking the candle, volume, or addplot layout; no source file or test is named in the report.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.