Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Inconsistent Volume Bar Border Colors Between v0.12.9b7 and v0.12.10b0 When Using make_marketcolors #676

Open
yorkjong opened this issue Jul 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@yorkjong
Copy link

yorkjong commented Jul 22, 2024

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

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):
download

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

@yorkjong yorkjong added the bug Something isn't working label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant