mplfinance icon indicating copy to clipboard operation
mplfinance copied to clipboard

Feature Request: Ability to use `marketcolor_overrides` to set candle colors in multi-panel plots.

Open rterbush opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. I'd like to be able to plot two panels of candles each colored differently. I am unable to use marketcolor_overrides to set candle color for make_addplot().

Describe the solution you'd like Use marketcolor_overrides parameter to set candle color on other panels.

Describe alternatives you've considered Unaware of any alternatives to do this other than fiddling with external axes.

rterbush avatar Apr 10 '23 14:04 rterbush

%matplotlib inline
import pandas as pd
import mplfinance as mpf
df = pd.read_csv('data/SPY_20110701_20120630_Bollinger.csv',index_col=0,parse_dates=True)
df.shape
fig = mpf.figure(figsize=(12,9))
ax1 = fig.add_subplot(2,2,1,style='yahoo')
ax2 = fig.add_subplot(2,2,2,style='yahoo')
mco = [None,None,'Yellow',None,None,'Blue',None,None,None,'Black']
mpf.plot(df.tail(10),
         ax=ax1,
         type='candle',
         axtitle='candle',
         xrotation=15
        )
mpf.plot(df.tail(10),
         type='candle',
         ax=ax2,
         axtitle='yahoo',
         xrotation=15,
         marketcolor_overrides=mco,
        )
fig

request

@rterbush try this method

DrChandrakant avatar Apr 27 '23 13:04 DrChandrakant

Yes, thank you @DrChandrakant . I figured out how to do this outside of mplf. My request is to allow doing this within mplf.

rterbush avatar Apr 27 '23 13:04 rterbush