python - 跳过图表python的x轴的间隔期
问题描述
我想自定义 pyplot 折线图的 x 轴。基本上,我有没有价值的时期,所以我想跳过这些时期。
数据示例:
排 | X | 是的 |
---|---|---|
以前的 | 2021-5-10 14:58 | 100.520 |
以前的 | 2021-5-10 14:59 | 100.500 |
红点 | 2021-5-10 15:00 | 100.550 |
绿点 | 2021-5-11 9:00 | 100.490 |
后 | 2021-5-11 9:01 | 100.650 |
后 | 2021-5-11 9:02 | 100.480 |
def chartValueTimeLine(time_series, value_series, line_color='blue', time_label='date', value_label='y_label', alpha_value=0.35, title='chart1'):
fig = plt.figure(figsize=(12.5, 7), num=title)
fig.subplots_adjust(bottom=0.2)
plt.plot(time_series, value_series, label=value_label, color = line_color, alpha=alpha_value)
plt.title(title)
plt.xticks(rotation=45)
plt.xlabel(time_label)
plt.ylabel(value_label)
plt.legend(loc='upper left')
我希望绿色点直接出现在 x 轴上的红色点之后。有谁知道如何做到这一点?
谢谢
解决方案
推荐阅读
- python - 对象身份
- c - 为什么我的多项式方法在小数组中正确工作,但在更大的数组中错误?
- ios - 在 Metal 中绘制带纹理的矩形 - Swift
- ios - CloudKit私有数据库读写工作无需用户登录iCloud
- java - 如何提示用户授予我的程序读/写权限
- macros - 在 FIJI/ImageJ 中编写用于荧光图像分析的宏循环
- php - Laravel 在几小时之间运行一批命令
- c++ - 在非 constexpr 函数中作为左值传递的变量上使用“constexpr”函数
- r - 取数据帧的 sum 和 col 名称的频率
- typescript - 使用 babel eslint 解析的 Typescript 强制转换