zoukankan      html  css  js  c++  java
  • PYTHON 绘制eps曲线图

    import pandas as pd
    
    import matplotlib.pyplot as plt
    
    data = pd.read_csv(r'D:实验数据记录kcss2次monitor.csv')
    # nodeIp = "192.168.1.27"
    # nodeIp = "192.168.1.90"
    # nodeIp = "192.168.1.100"
    # nodeIp = "192.168.1.127"
    nodeIp = "192.168.1.187"
    df = data.loc[data['node_ip'] == nodeIp, :]
    print(df)
    # 分别拿到时间戳与值
    values = df['cpu_util'].values
    timestamps = df['record_time'].values
    
    # 为了避免数据太多可以考虑展现其中一部分
    pieceSize = 4
    showPiece = 1  # [1,pieceSize]
    
    # 开始准备绘制
    plt.figure(num='cpu4', figsize=(16, 7))
    # plt.title('cpu4-'+str(showPiece))
    
    
    # start = int(len(timestamps)*(showPiece/pieceSize))
    # end = int(len(timestamps)*((showPiece+1)/pieceSize))
    start = 0
    end = len(timestamps)
    plt.plot(timestamps[start:end], values[start:end], color="BLACK")
    
    plt.show()
    
    # 如果不展示而是导出为 eps 文件,非常简单
    #plt.savefig(nodeIp + str(showPiece) + '.eps', format='eps', bbox_inches='tight')
    plt.savefig(nodeIp + '.eps', format='eps', bbox_inches='tight')
    
  • 相关阅读:
    青蛙的约会
    租用游艇问题
    宾馆房间
    [USACO10FEB]购买巧克力Chocolate Buying
    骑士的工作
    Power Strings
    [HAOI2006]聪明的猴子
    骑马修栅栏 Riding the Fences
    [USACO06JAN]牛的舞会The Cow Prom
    UVA 11294 wedding 2-sat
  • 原文地址:https://www.cnblogs.com/ljincheng/p/14922003.html
Copyright © 2011-2022 走看看