python-3.x - 开始远离 y 轴的线图
问题描述
代码如下
import pandas as pd
import matplotlib.pyplot as plt
dates = ['2010-11', '2011-12', '2012-13', '2013-14', '2014-15', '2015-16', '2016-17']
steps = [9000, 9500.756, 9800.859, 10000.262, 9800.972, 10500.058, 11300.703]
fig=plt.figure(figsize=(10,8))
ax=fig.add_subplot(111)
ax.set(xlabel="X-axis",ylabel="Y-axis",title="2d line plot",xlim=(0,8),ylim=(2000,15000))
ax.plot(dates,steps, color='red',linewidth=2,marker='o',label='LPG')
plt.show()
plt.close('all')
运行此代码,我得到如下图
这里的情节是从 y 轴开始的
解决方案
推荐阅读
- lua - 如何在此代码中实现去抖动
- c# - Nopcommerce - 自定义付款方式的 PostProcessPayment 未重定向到付款网关 URL
- python - 如何扩展 client.command 的功能?
- python - 迭代空白电子表格时如何将占位符插入聚合的df
- javascript - 有人可以解释这段代码的工作原理吗?
- python - Seaborn 带状图,点前带有小提琴图条
- c++ - 在亚马逊 Linux 上“cmake”到 libigl 时找不到 libigl
- asynchronous - 如何异步处理子进程的 I/O?
- python - pandas:如何注册自定义数据框属性?
- azure-cosmosdb - 在存在多主复制的情况下,CosmosDB 更改源的行为如何?