Home > database >  How do I set the tick and label colours in mplfinance?
How do I set the tick and label colours in mplfinance?

Time:01-22

I have managed to colour coordinate most of my mplfinance chart but I cannot seeem to figure out how to set the colour of the tick and labels. enter image description here

I currently have the following code:

market_colours = mpf.make_marketcolors(up="g", down="r", edge=BACKGROUND_COLOUR, wick=LINE_COLOUR)
style = mpf.make_mpf_style(marketcolors=market_colours, facecolor=BACKGROUND_COLOUR, edgecolor=LINE_COLOUR,
                           figcolor=BACKGROUND_COLOUR, gridcolor=LINE_COLOUR, gridstyle="--")

mpf.plot(df, type="candle", style=style)

This is my code in matplotlib to do this usually:

ax.xaxis.label.set_color(TEXT_COLOUR)
ax.yaxis.label.set_color(TEXT_COLOUR)
for axis in ["left"]:  # modify borders
    ax.spines[axis].set_color(LINE_COLOUR)
    ax.spines[axis].set_linewidth(3)
for axis in ["top", "right", "bottom"]:  # remove borders
    ax.spines[axis].set_linewidth(0)
for axis in ["x", "y"]:
    ax.tick_params(axis=axis, colors=LINE_COLOUR, which="both", width=2)

The answer to enter image description here

I have only included in this sample code a style_dic dictionary with easily found rcparams, and I have the impression that you will not be able to alter all desired image aspects with this strategy. A list of the rcparams can be found enter image description here

  •  Tags:  
  • Related