我认为你可以先画柱状图,然后再画折线图。对绘制的顺序有什么限制吗?
import matplotlib.pyplot as plt
import pandas as pd
data = [10,20,30,40,50]
index = [0,1,2,3,4]
data_1 = [25,15,35,45,55]
foreground_opacity = 1.0
dataFrame = pd.DataFrame({'data':data}, index=index)
# fig, ax2 = plt.subplots(figsize=(10, 5))
axs = dataFrame.plot.bar(rot=15, alpha=foreground_opacity, figsize=(10, 5))
ax = axs.twinx()
ax.plot(index, data_1, color='r', lw=3)