使用python实现双柱状图,并且在柱状图形的顶部显示对应数值;
二、双柱状图实现代码import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pylab import mpl
mpl.rcParams['font.sans-serif']=['KaiTi']
mpl.rcParams['font.serif']=['KaiTi']
df=pd.read_csv('data.csv',index_col=0,encoding='gbk')
df.plot(kind='bar',width=0.4)
labels = ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]
men_means = df["蒸发量"].values.tolist()
women_means = df["降水量"].values.tolist()
x = np.arange(len(labels)) # the label locations
width = 0.4 # the width of the bars
fig, ax = pl
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)