'mplfinance ylabel fontsize

I'm using mplfinance to create a plot that visualizes price and volume by date.

I have a trouble adjusting the fontsize of the ylabel (price) and ylabel_lower (volume).

Any idea how to adjust it?

customstyle = mpf.make_mpf_style(base_mpf_style="yahoo",y_on_right=False,
                                 rc={'xtick.labelsize':14,'ytick.labelsize':12})

fig, axes = mpf.plot(data,type="candle", figsize=(10,5), style = customstyle,
                     returnfig=True, xrotation=0,tight_layout=True, volume=True,
                     ylabel="price",ylabel_lower="volume")


Solution 1:[1]

The axis label font size is considered part of the mplfinance style.

Please first read the mplfinance styles tutorial to understand how styles work in mplfinance.

You can then copy a style that you like, and adjust the label font size by setting axes.labelsize using the rc= kwarg of make_mpf_style(). In the following example we copy style 'yahoo'.

myrcparams={'axes.labelsize':'medium'}
mystyle = mpf.make_mpf_style(base_mpf_style='yahoo',rc=myrcparams)
mpf.plot(df,type='candle',style=mystyle)

Note that, as above you can set the label size using words such as 'x-small','small', 'medium', 'large', 'x-large', 'xx-large', or numbers such as 7, 8, 10, 12, 14, 18. For example, `myrcparams={'axes.labelsize':12}.

(The number examples listed above (7,8,...18) approximately correspond to the ('x-small'...'xx-large') word examples listed above.)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Goldfarb