My code is:
fig = make_subplots(rows = 1, cols = 1, shared_xaxes = True, subplot_titles =
(currency_name+' '+timeframe), vertical_spacing = 0.1, row_width = [0.6])
# ----------------
# Candlestick Plot
fig.add_trace(go.Candlestick(x = chart.index, open = chart['open'], high =
chart['high'], low = chart['low'], close = chart['close'], showlegend=False, name =
'candlestick'), row = 1, col = 1)
# Moving Average
fig.add_trace(go.Scatter(x = chart.index, y = chart['middle_band'], line_color =
'green', name = 'middle_band', opacity = 0.5), row = 1, col = 1)
# Upper Bound
fig.add_trace(go.Scatter(x = chart.index, y = chart['upper_band'], line_color =
'green', name = 'upper band', opacity = 0.7), row = 1, col = 1)
# Lower Bound
fig.add_trace(go.Line(x = chart.index, y = chart['lower_band'], line_color = 'green',
name = 'lower band', opacity = 0.7), row = 1, col = 1)
fig.update_layout(
title='Bolindger Bands',
yaxis_title=currency[5]+' '+timeframe,
shapes = [dict(
x0=chart.index[0].to_pydatetime(), x1=chart.index[0].to_pydatetime(), y0=0.1,
y1=0.2, xref='x', yref='paper',
line_width=1)],
annotations=[dict(
x=chart.index[0].to_pydatetime(), y=0.01, xref='x', yref='paper',
showarrow=False, xanchor='right', text=str(candle_pattern)+ ' here')])
# Remove range slider; (short time frame)
fig.update(layout_xaxis_rangeslider_visible=False)
fig.show()
And I got nice picture with candlesticks and indicators, but I cant find the way how to save it to png?
fig.savefig() doesnt work with make_subplots. How to save exactly that picture which I got after fig.show() to png?