python科研做图系列之时序图的绘制——对比折线图

参考知乎

折线图

我需要从两个不同的excel都读取第一列作为时间列,第二列作为编码列。
在同一张图上画出两条时间序列的折线图
横坐标是分钟,纵坐标是编码
帮我画的好看一些,记得解决中文乱码问题

英文版折线图

,先搞个英文版,导师要求中文的话,再换成中文版
在这里插入图片描述

import pandas as pd
import matplotlib.pyplot as plt

# Reading the Excel files
file1 = 'merged_output.xlsx'
file2 = 'mAI.xlsx'

# Assuming the sheets are named "Sheet1" in both files
df1 = pd.read_excel(file1, sheet_name='Sheet1')
df2 = pd.read_excel(file2, sheet_name='Sheet1')

# Extracting the first and second columns as time and code
code1,time1 = df1.iloc[:, 0], df1.iloc[:, 1]
code2,time2 = df2.iloc[:, 0], df2.iloc[:, 1]

# Plotting the time series
plt.figure(figsize

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-06-11 15:12:05       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-11 15:12:05       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-11 15:12:05       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-11 15:12:05       20 阅读

热门阅读

  1. 设计与实现完整的余额充值系统

    2024-06-11 15:12:05       10 阅读
  2. Web前端开发学习内容:深入探索与全方位掌握

    2024-06-11 15:12:05       9 阅读
  3. C++算法——选择排序

    2024-06-11 15:12:05       6 阅读
  4. mysql数据聚合实例

    2024-06-11 15:12:05       9 阅读
  5. 用python海龟画图实现倒计时功能

    2024-06-11 15:12:05       6 阅读
  6. Webpack5 解决静态资源重复打包问题

    2024-06-11 15:12:05       7 阅读
  7. C++ CSV 中文 乱码 UTF-8 ANSI

    2024-06-11 15:12:05       7 阅读
  8. 微信小程序轮播

    2024-06-11 15:12:05       6 阅读