I made a chart and I want to download this chart to my computer using code. I tried several different ways, but each time the program freezes without any errors and does not respond at all. I'm leaving the code I'm using. Note: I removed the unnecessary parts from the code, I can add if necessary. Note2: I thing I downloaded every necessary libs etc.
columns = ['time', 'open', 'high', 'low', 'close', 'volume', 'close_time', 'quote_asset_volume', 'number_of_trades',
'taker_buy_base_asset_volume', 'taker_buy_quote_asset_volume', 'ignore']
btcusd_history_df = pd.DataFrame(btcusd_history, columns=columns)
btcusd_history_df['time'] = pd.to_datetime(btcusd_history_df['time'], unit='ms')
display(btcusd_history_df)
# plot results
fig = go.Figure(data=[go.Candlestick(x=btcusd_history_df['time'],
open=btcusd_history_df['open'],
high=btcusd_history_df['high'],
low=btcusd_history_df['low'],
close=btcusd_history_df['close'])])
fig.update_layout(xaxis_rangeslider_visible=False, title = '')
fig.show()
fig.write_image('file.png')