matplotlib / matplotlib/mplfinance
Bug Report: Inconsistent Volume Bar Border Colors Between v0.12.9b7 and v0.12.10b0 When Using make_marketcolors
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 678
- PR merge metrics
- No merged PRs in 30d
Description
**Description**
When changing the volume colors using `make_marketcolors`, the results differ between versions v0.12.9b7 and v0.12.10b0. The older version looks fine, but in the newer version, the border color of the volume bars appears inconsistent.
**Minimal Test Code**
```python
import mplfinance as mpf
import pandas as pd
# Sample data
dates = pd.date_range('2023-01-01', periods=10)
data = {
'Open': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
'High': [2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
'Low': [0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5],
'Close': [2, 1, 4, 3, 6, 5, 8, 7, 10, 9],
'Volume': [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
}
df = pd.DataFrame(data, index=dates)
# Get the 'yahoo' style
yahoo_style = mpf.make_mpf_style(base_mpf_style='yahoo')
# Access the 'yahoo' style market colors
yahoo_market_colors = yahoo_style['marketcolors']
# Reverse the colors
reversed_market_colors = mpf.make_marketcolors(
up=yahoo_market_colors['candle']['down'],
down=yahoo_market_colors['candle']['up'],
edge={'up': yahoo_market_colors['edge']['down'], 'down': yahoo_market_colors['edge']['up']},
wick={'up': yahoo_market_colors['wick']['down'], 'down': yahoo_market_colors['wick']['up']},
ohlc={'up': yahoo_market_colors['ohlc']['down'], 'down': yahoo_market_colors['ohlc']['up']},
volume={'up': yahoo_market_colors['volume']['down'], 'down': yahoo_market_colors['volume']['up']}
)
# Define a new style with reversed colors
reversed_style = mpf.make_mpf_style(base_mpf_style='yahoo', marketcolors=reversed_market_colors)
# Plot the candlestick chart
mpf.plot(df, type='candle', volume=True, style=reversed_style)
```
**Screenshots**
v0.12.9b7 (looks fine):

v0.12.10b0 (the border color of the volume bars appears inconsistent):

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 running the minimal test code with mplfinance v0.12.9b7 and v0.12.10b0, focusing on make_marketcolors, make_mpf_style, and mpf.plot with volume enabled. Trace how the reversed volume colors reach the volume bars and compare the rendered borders. Done means the newer version produces consistent volume-bar border colors with the requested market colors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100