python - Matplotlib 没有绘制所有数据点
问题描述
我面临一个问题,我有 13 个数据点,但 Matplotlib 只能绘制到大约 8-9 个数据点。下面是我的代码:
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import numpy as np
pv = [1240, 1390, 1635, 1885, 2025, 2165, 2290, 2965, 3455, 4510, 4975, 5510, 5795]
ac = [1200, 1325, 1555, 1835, 1985, 2135, 2285, 2435, 2985]
ev = [1240, 1390, 1635, 1885, 2025, 2165, 2165, 2165, 2690]
time = np.arange(1, 14)
y1 = np.zeros(13)
fig = plt.figure(figsize=(10,5))
ax = plt.axes(projection='3d')
ax.plot(xs=time, ys=y1, zs=pv, label="PV")
ax.plot(xs=time[0: 9], ys=(y1+1)[0: 9], zs=ac, label="AC")
ax.plot(xs=time[0: 9], ys=(y1+2)[0: 9], zs=ev, label="EV")
ax.set_yticklabels([])
ax.set_xticks(time)
ax.set_title("Earned Value Analysis")
ax.set_xlabel("Time(Week)")
ax.set_zlabel("Cummulative Cost")
plt.legend(loc="lower right")
plt.show()
在 13 时,我的 PV 应该在 5795 左右。但是,该图仅绘制到 8-9 时左右。感谢任何人清除我的疑问。
解决方案
推荐阅读
- php - 无法在函数类中调用全局变量
- python - 日志没有写入文件
- c# - 如何查询大型数据表而不在 MVC 应用程序中遇到错误?
- c - 在流程程序 c 之后查看 gdb 中的寄存器不会更改
- azure-ad-b2c - Microsoft Azure > Azure 活动目录
- javascript - 从渲染中的反应函数返回的访问变量(在循环中)
- c# - 对整数字段进行排序不起作用
- ios - 从另一个 ViewController Swift 4 访问对象(SQLite 表)
- c# - Xamarin 表单检查 Internet 连接
- wordpress - Wordpress 自定义按钮/动作自定义帖子类型