I am fetching the data from csv which is being updated from websocket. in the chart alothough candles are showing but they squezing the space between candles and getting smaller and smaller. Please let me know what is wrong I am doing.
fig = mpf.figure(style='binance',figsize=(12,4))
ax1 = fig.add_subplot(1,1,1)
def animate(ival):
df = pd.read_csv('bitcoin_data.csv', index_col=0, parse_dates=True)
df = df[['minute', 'open', 'high',
'low', 'close']]
df.minute = pd.to_datetime(df.minute)
df = df.set_index('minute')
ax1.clear()
mpf.plot(df, ax=ax1, type='candlestick', ylabel='price')
ani = animation.FuncAnimation(fig, animate, interval=1000)\
mpf.show()
