酷代码 AI
菜单
全部AI  /  热门  /  AI写代码神器
服务商

from typing import list import matplotlib.pyplot as plt # 对象式绘图 # pyplot模块中的figure()函数创建名fig的figure对象 fig=plt(figsize=(12,8)) # 在figure对象中创建一个axes对象,每个axes对象即为一个绘图区域 ax=fig.add_subplot(111) #pandas 生成时间序列 date_index=pd.date_range('2019-01-01',frep='d',periods=10) # 分别模拟生成涨跌时的成交量数据 red_ber =【1000,0,0,0,879,986,213,0,0,0,】 green—bar=[0,200,599,567,0,0,0,234,998,489] # 绘制条形图 ax.bar(date_index,red_ber,facecolor='red') ax.bar(date_index,green_bar,facecolor='green') # 设置轴标题 ax.set_xlabel(u'交易日',fonts

=12) ax.set_ylabel(u'成交量',fontsize=12) # 设置图标题 ax.set_title(u'涨跌时的成交量',fontsize=12) # 显示图例 ax.legend(['涨','跌']) # 显示图形 plt.show() [2024-11-21 20:57:20 | AI写代码神器 | 104点数解答]

相关提问