I am new from matplotlib. May I know how to use loop function to plot this chart? Also, how to add spacing to the x-axis?
The code like this:
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.ticker as ticker
%matplotlib inline
plt.figure(figsize=(15,6))
ax1 = plt.subplot(2,5,1)
plt.plot(tickers_data.index.strftime("%d"),tickers_data['Volume','XPEV'])
plt.ticklabel_format(style='plain', axis='y')
plt.title('XPEV')
ax2 = plt.subplot(2,5,2)
plt.plot(tickers_data.index.strftime("%d"),tickers_data['Volume','M'])
plt.ticklabel_format(style='plain', axis='y')
plt.title('M')
ax3 = plt.subplot(2,5,3)
plt.plot(tickers_data.index.strftime("%d"),tickers_data['Volume','MLCO'])
plt.ticklabel_format(style='plain', axis='y')
plt.title('MLCO')
ax4 = plt.subplot(2,5,4)
plt.plot(tickers_data.index.strftime("%d"),tickers_data['Volume','VIPS'])
plt.ticklabel_format(style='plain', axis='y')
plt.title('VIPS')
ax5 = plt.subplot(2,5,5)
plt.plot(tickers_data.index.strftime("%d"),tickers_data['Volume','HD'])
plt.ticklabel_format(style='plain', axis='y')
plt.title('HD')

plt.tight_layout()at the end? Also note thatplt.subplot(2,5,1)is the old interface to create subplots. Usingfig, axs = plt.subplots(2, 5)is now the recommended way. See e.g. matplotlib.org/stable/gallery/subplots_axes_and_figures/… for an introduction.