使用 x 和 y 的数据框使用 Matplotlib 生成直方图
我正在用 Matplotlib 生成一个简单的折线图,这是我的代码:fig = plt.figure(facecolor='#131722',dpi=155, figsize=(8, 4))ax1 = plt.subplot2grid((1,2), (0,0), facecolor='#131722')for x in OrderedList: rate_buy = [] total_buy = [] for y in x['data']['bids']: rate_buy.append(y[0]) total_buy.append(y[1]) rBuys = pd.DataFrame({'buy': rate_buy}) tBuys = pd.DataFrame({'total': total_buy}) ax1.plot(rBuys.buy, tBuys.total, color='#0400ff', linewidth=0.5, alpha=1) ax1.fill_between(rBuys.buy, 0, tBuys.total, facecolor='#0400ff', alpha=1)这给了我以下输出:这是我在数据框中使用的数据: buy0 96111 96102 96093 96084 96075 96066 96057 96048 96039 960210 960111 960012 9599 total0 3.0336611 3.2957532 3.5998133 22.3057654 22.9874765 30.9751456 39.4928457 42.8285808 46.6777089 49.53374010 50.92584011 61.39624312 61.921523我想获得相同的图像输出,但使用直方图图表或类似的任何东西,其中从数据帧检索 y 轴上的列高度,从total数据帧检索 x 轴位置buy。所以第一个元素将有位置x=9611和y=3.033661有可能用 Matplotlib 做到这一点吗?我尝试使用hist,但它不允许我同时设置 x 轴和 y 轴
查看完整描述