python画三条线的折线图

直接上代码

复制代码
#!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: Suyue
@file: zhexiantu.py
@time: 2024/05/10
@desc:
"""
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
matplotlib.rc("font",family='YouYuan')

input_file = 'G:/数浓度/20230618/清水河/shunongdu.xlsx'

df = pd.read_excel(input_file)
x = df['粒径']
y1 = df['作业中']
y2 = df['作业后1h']
y3 = df['作业后2h']
plt.title('数浓度')
plt.xlabel('粒径')
plt.ylabel('数浓度')
plt.plot(x,y1,marker='o',markersize=3)
plt.plot(x,y2,marker='o',markersize=3)
plt.plot(x,y3,marker='o',markersize=3)

# 加断点
# for a ,b in zip(x,y1):
#     plt.text(a, b, b, ha='center', va='bottom', fontsize=10)
# for a ,b in zip(x,y2):
#     plt.text(a, b, b, ha='center', va='bottom', fontsize=10)
# for a ,b in zip(x,y3):
#     plt.text(a, b, b, ha='center', va='bottom', fontsize=10)

plt.legend(['作业中','作业后1h','作业后2h'])

plt.show()
复制代码

 

posted @   秋刀鱼CCC  Views(99)  Comments(0Edit  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· Vue3状态管理终极指南:Pinia保姆级教程
点击右上角即可分享
微信分享提示