I have the following code:
from pandas_datareader import data as web
df = web.DataReader('goog','yahoo', start="2021-07-3", end="2021-09-12")
mpf.plot(df, style='charles', type = 'candle', volume=True, figratio=(12,8), title = "new title \n another title")
Could you please advise how can I change the font and size of newline another title
?
Also, if I want to suppress the plot from being plotted in spyder/jupyter and just be saved how can I do that. Reason is RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory.
returnfig=True
to extract the fig
and a list of axes
objects.matplotlib
methods to add an axes title
and a figure suptitle
, because title
in mpf.plot
is actually the figure suptitle
, not the axes title
.fig.clf()
to manage the RuntimeWarning
if too many figures are created in a loop.matplotlib.axes.Axes.set_title
matplotlib.pyplot.suptitle
matplotlib.text.Text
for text properties like style
df = web.DataReader('goog','yahoo', start="2021-07-3", end="2021-09-12")
fig, axlist = mpf.plot(df, style='charles', type = 'candle', volume=True, figratio=(12,8), returnfig=True)
# add a new suptitle
fig.suptitle('Figure Title', y=1.05, fontsize=30, x=0.59)
# add a title the the correct axes
axlist[0].set_title('Axis Title', fontsize=25, style='italic', fontfamily='fantasy', loc='center')
# save the figure
fig.savefig('test.jpg', bbox_inches='tight')