精华内容
下载资源
问答
  • import pandas as pdimport xlwtimport osimport matplotlib.pyplot as pltimport numpy as npworkbook = xlwt.Workbook()#name_list = ['V_YDJT_MHXT_DB_01_USED .xls', 'V_YDJT_HRXT_DB_01_USED.xls', 'V_YDJT_DS_...

    import pandas as pd

    import xlwt

    import os

    import matplotlib.pyplot as plt

    import numpy as np

    workbook = xlwt.Workbook()

    #name_list = ['V_YDJT_MHXT_DB_01_USED .xls', 'V_YDJT_HRXT_DB_01_USED.xls', 'V_YDJT_DS_DB_01_USED.xls']

    name_list = ['V_YDJT_MHXT_DB_01_USED']

    files = os.listdir(r'.')

    for txt_file in files:

    for name in name_list:

    if name in txt_file:

    # print(txt_file)

    df = pd.DataFrame(pd.read_excel(txt_file))

    istackList = df[['istack']].values.T.tolist()[:][0]

    computeList = df[['compute01']].values.T.tolist()[:][0]

    ipList = df[['ip']].values.T.tolist()[:][0]

    instanceList = df[['instance-name']].values.T.tolist()[:][0]

    # print (instanceList [0] )

    # print("all istack")

    # print(istackList)

    istackList = list(set(istackList))

    # print("NO repetition")

    # print(istackList)

    for name in istackList:

    istack = df.loc[df['istack'] == name]

    # print('\r\n')

    # print(istack)

    # data

    a = istack["cpu_used"].describe()

    print(a)

    dfc = pd.DataFrame(istack ['cpu_used'],index= istack ['date'])

    #dfc.plot(kind='line', rot=0)

    dfm = pd.DataFrame(istack['mem_used'], index=istack['date'])

    #dfm.plot(kind='line', rot=0)

    dfd = pd.DataFrame(istack['disk_used'], index=istack['date'])

    #dfd.plot(kind='line', rot=0)

    ax = dfc.plot()

    dx=dfm.plot( legend='w1', title=name, ax=ax)

    dfd.plot(legend='w1', title=name, ax=dx)

    plt.show()

    # # plot

    # data = istack.ix[0:, 4:7]

    # #print(data)

    # comp1=istack["cpu_used"]

    # comp2=istack["mem_used"]

    # comp3=istack["disk_used"]

    # values = pd.Series(np.concatenate([comp1, comp2,comp3]))

    # print (values)

    # import matplotlib.pyplot as plt

    #

    # values.hist( color='k', normed=True)

    # values.plot(kind='kde', style='k--')

    #

    # plt.show()

    # cmean = '%.2f' % (istack["cpu_used"].mean())

    # cmin = '%.2f' % (istack["cpu_used"].min())

    # cmax = '%.2f' % (istack["cpu_used"].max())

    #

    # mmean = '%.1f' % (istack["mem_used"].mean())

    # mmin = '%.1f' % (istack["mem_used"].min())

    # mmax = '%.1f' % (istack["mem_used"].max())

    #

    # dmean = '%.1f' % (istack["disk_used"].mean())

    # dmin = '%.1f' % (istack["disk_used"].min())

    # dmax = '%.1f' % (istack["disk_used"].max())

    # # print(type(dmin)) str

    #

    # # print("istack %s cmean %s cmin "

    # # "%s cmax %s mmean %s mmin %s mmax %s dmean %s dmin %s dmax %s "

    # # ""%(istackList[i],cmean,cmin,cmax,mmean,mmin,mmax,dmean,dmin,dmax))

    # advisec = "0"

    # advisem = "0"

    # advised = "0"

    # if float(cmin) < 10:

    # advisec = "Reduce cpu"

    # # print (advisec)

    # elif float(cmax) >= 50:

    # advisec = "Expand cpu"

    # # print (advisec)

    # else:

    # advisec = "No change cpu"

    # # print (advisec)

    #

    # if float(mmin) < 10:

    # advisem = "Reduce mem"

    # # print (advisem)

    # elif float(mmax) >= 50:

    # advisem = "Expand mem"

    # # print (advisem)

    # else:

    # advisem = "No change mem"

    # # print (advisem)

    # # disk

    # if float(dmax) > 50.0:

    #

    # advised = "Expand disk"

    # # print (advised)

    # else:

    # advised = "No change disk"

    # # print (advised)

    #

    # adv = "%s %s %s %s %s " \

    # " %s %s %s %s %s %s %s %s %s %s %s" \

    # % (

    # istackList[0], computeList[0], ipList[0], instanceList[0], cmax, cmin, cmean, mmax, mmin,

    # mmean,

    # dmax, dmin, dmean, advisec, advisem, advised)

    # print(adv)

    # # writer

    # st = str(name)

    # sheet = workbook.add_sheet(st, cell_overwrite_ok=False)

    # sheet.write(0, 0, adv) # row, column, value

    # workbook.save(str(name) + "advise.xls")

    展开全文
  • pandas 一个折线图

    万次阅读 2019-06-19 17:17:46
    画图 import pandas as pd import xlwt import os import matplotlib.pyplot as plt import numpy as np workbook = xlwt.Workbook() #name_list = ['V_YDJT_MHXT_DB_01_USED .xls', 'V_YDJT_HRXT_DB_01_USED.xls', ...

    在这里插入图片描述画图

    import pandas as pd
    import xlwt
    import os
    import matplotlib.pyplot as plt
    import numpy as np
    workbook = xlwt.Workbook()
    #name_list = ['V_YDJT_MHXT_DB_01_USED .xls', 'V_YDJT_HRXT_DB_01_USED.xls', 'V_YDJT_DS_DB_01_USED.xls']
    name_list = ['V_YDJT_MHXT_DB_01_USED']
    files = os.listdir(r'.')
    for txt_file in files:
    
        for name in name_list:
            if name in txt_file:
                # print(txt_file)
    
                df = pd.DataFrame(pd.read_excel(txt_file))
                istackList = df[['istack']].values.T.tolist()[:][0]
                computeList = df[['compute01']].values.T.tolist()[:][0]
                ipList = df[['ip']].values.T.tolist()[:][0]
                instanceList = df[['instance-name']].values.T.tolist()[:][0]
                # print (instanceList [0] )
                # print("all istack")
                # print(istackList)
                istackList = list(set(istackList))
                # print("NO repetition")
                # print(istackList)
                for name in istackList:
                    istack = df.loc[df['istack'] == name]
                    # print('\r\n')
                    # print(istack)
    
                    # data
                    a = istack["cpu_used"].describe()
                    print(a)
    
    
    
                    dfc = pd.DataFrame(istack ['cpu_used'],index= istack ['date'])
                    #dfc.plot(kind='line', rot=0)
                    dfm = pd.DataFrame(istack['mem_used'], index=istack['date'])
                    #dfm.plot(kind='line', rot=0)
                    dfd = pd.DataFrame(istack['disk_used'], index=istack['date'])
                    #dfd.plot(kind='line', rot=0)
                    ax = dfc.plot()
                    dx=dfm.plot( legend='w1', title=name, ax=ax)
                    dfd.plot(legend='w1', title=name, ax=dx)
    
    
    
                    plt.show()
    
                    # # plot
                    # data = istack.ix[0:, 4:7]
                    # #print(data)
                    # comp1=istack["cpu_used"]
                    # comp2=istack["mem_used"]
                    # comp3=istack["disk_used"]
                    # values = pd.Series(np.concatenate([comp1, comp2,comp3]))
                    # print (values)
                    # import matplotlib.pyplot as plt
                    #
                    # values.hist( color='k', normed=True)
                    # values.plot(kind='kde', style='k--')
                    #
                    # plt.show()
    
                    # cmean = '%.2f' % (istack["cpu_used"].mean())
                    # cmin = '%.2f' % (istack["cpu_used"].min())
                    # cmax = '%.2f' % (istack["cpu_used"].max())
                    #
                    # mmean = '%.1f' % (istack["mem_used"].mean())
                    # mmin = '%.1f' % (istack["mem_used"].min())
                    # mmax = '%.1f' % (istack["mem_used"].max())
                    #
                    # dmean = '%.1f' % (istack["disk_used"].mean())
                    # dmin = '%.1f' % (istack["disk_used"].min())
                    # dmax = '%.1f' % (istack["disk_used"].max())
                    # # print(type(dmin))  str
                    #
                    # # print("istack %s  cmean %s cmin "
                    # #     "%s cmax %s mmean %s mmin %s mmax %s dmean %s dmin %s dmax %s  "
                    # #    ""%(istackList[i],cmean,cmin,cmax,mmean,mmin,mmax,dmean,dmin,dmax))
                    # advisec = "0"
                    # advisem = "0"
                    # advised = "0"
                    # if float(cmin) < 10:
                    #     advisec = "Reduce cpu"
                    #     # print (advisec)
                    # elif float(cmax) >= 50:
                    #     advisec = "Expand cpu"
                    #     # print (advisec)
                    # else:
                    #     advisec = "No change cpu"
                    #     # print (advisec)
                    #
                    # if float(mmin) < 10:
                    #     advisem = "Reduce mem"
                    #     # print (advisem)
                    # elif float(mmax) >= 50:
                    #     advisem = "Expand mem"
                    #     # print (advisem)
                    # else:
                    #     advisem = "No change mem"
                    #     # print (advisem)
                    # # disk
                    # if float(dmax) > 50.0:
                    #
                    #     advised = "Expand disk"
                    #     # print (advised)
                    # else:
                    #     advised = "No change disk"
                    #     # print (advised)
                    #
                    # adv = "%s %s %s %s %s " \
                    #       " %s  %s  %s   %s   %s   %s   %s   %s   %s %s %s" \
                    #       % (
                    #           istackList[0], computeList[0], ipList[0], instanceList[0], cmax, cmin, cmean, mmax, mmin,
                    #           mmean,
                    #           dmax, dmin, dmean, advisec, advisem, advised)
                    # print(adv)
                    # # writer
                    # st = str(name)
                    # sheet = workbook.add_sheet(st, cell_overwrite_ok=False)
                    # sheet.write(0, 0, adv)  # row, column, value
                    # workbook.save(str(name) + "advise.xls")
    
    
    展开全文
  • 使用matplotlib绘制折线图   直接使用plot()函数  plt.plot(x,y,format_string,**kwargs)  x轴数据,y轴数据,format_string控制曲线的格式字串,format_string由颜色字符,风格字符,和标记字符 。  导入库 ...

    使用matplotlib绘制折线图
      
    直接使用plot()函数
      plt.plot(x,y,format_string,**kwargs)
      x轴数据,y轴数据,format_string控制曲线的格式字串,format_string由颜色字符,风格字符,和标记字符 。  
    在这里插入图片描述
    在这里插入图片描述

    导入库

    import matplotlib.pyplot as plt
    

    数据部分

    allX=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 54, 55, 57, 58, 60, 62, 63, 64, 65, 66, 67, 70, 71, 74, 77, 79, 80, 83, 84, 86, 87, 89, 91, 96, 97, 99, 106, 108, 110, 116, 123]
    allY=[117, 131, 141, 93, 101, 62, 72, 53, 40, 40, 39, 37, 34, 33, 25, 28, 26, 17, 17, 15, 10, 13, 10, 15, 15, 16, 10, 10, 9, 6, 6, 14, 7, 6, 4, 10, 9, 9, 3, 5, 4, 5, 1, 2, 4, 2, 5, 1, 3, 3, 1, 2, 5, 1, 2, 3, 1, 3, 1, 1, 2, 2, 3, 3, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1]
    stuX=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 40, 42, 45, 48, 50, 51, 55, 66, 84]
    stuY=[34, 52, 64, 42, 43, 23, 26, 18, 17, 11, 9, 10, 8, 14, 9, 9, 5, 3, 3, 4, 5, 4, 4, 4, 5, 1, 1, 4, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 2]
    adsX=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 54, 55, 57, 58, 60, 62, 63, 64, 65, 66, 67, 70, 71, 74, 77, 79, 80, 83, 84, 86, 87, 89, 91, 96, 97, 106, 108, 110, 116, 123]
    adsY=[40, 52, 66, 41, 54, 37, 44, 37, 19, 30, 27, 23, 23, 18, 16, 23, 21, 14, 14, 15, 9, 11, 8, 10, 14, 16, 10, 8, 8, 5, 6, 13, 7, 5, 4, 9, 9, 8, 3, 5, 4, 4, 1, 2, 3, 2, 4, 1, 3, 3, 1, 2, 4, 1, 2, 3, 1, 3, 1, 1, 2, 2, 3, 3, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1]
    

    绘图

    	# 总体度的分布
        plt.figure()
        plt.plot(allX, allY, label="总体度的分布", linestyle=":")
    
        # advisee度的折线图分布
        plt.plot(stuX, stuY,label="advisee度的分布", linestyle="--")
    
        # advisor度的折线图分布
        plt.plot(adsX, adsY, label="advisor度的分布", linestyle="-.")
        plt.legend()
        plt.title("度的分布折线图")
        plt.xlabel("度数")
        plt.ylabel("频次")
        plt.show()
    

    结果

    在这里插入图片描述

    展开全文
  • 一个简单的折线图view.rar,太无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
  • 主要为大家详细介绍了python绘制多个曲线的折线图,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
  • I was having trouble creating a plot I need which has multiple line graphs.What I want is a way to graph each of these above the other (say one has a baseline of y=5 I want the next to have a baseline...

    I was having trouble creating a plot I need which has multiple line graphs.

    What I want is a way to graph each of these above the other (say one has a baseline of y=5 I want the next to have a baseline of y=10) and also each of these graphs must block the one above it.

    So this will inevitably look like the cover to Joy Divisions Unknown Pleasures here:

    http://cococubed.asu.edu/images/unknown_pleasures/unknown_pleasures.jpg

    Except inverted colors and I also would like an answer that utilizes python or numpy or matplotlib.

    解决方案

    Here's one way. The key point is to use fill_between function and offset each plotted line with some margin (i*2 in this case). Also, plotting has to start from the top, hence the [::-1] in the arange slice.

    t=linspace(-2*pi, 2*pi, 1000)

    for i in arange(1, pi, 0.01)[::-1]:

    left = exp(-(t + (i - 1) * 2*pi)**2) * cos(t * i)**2 - 1

    right = exp(-(t - (i - 1) * 2*pi)**2) * cos(t * i)**2 - 1

    vertical_offset = i*2

    fill_between(t, vertical_offset + left + right, facecolor='white')

    8030c9d3a69eca8fe5bff8a334541d20.png

    展开全文
  • K线图,趋势图,折线图,柱状图等多个demo,日K线是根据股价(指数)天的走势形成的四个价位即:开盘价,收盘价,最高价,最低价绘制而成的。
  • 项目开发当中遇到一个需求,需要个折线图当中显示多个实时数据,刚开始觉得有点困难,毕竟echarts虽然用了很久了,但是里面的api参数很多,常用的就是饼状图、柱状图、以及折线图,对于这种需求立马就是网上...
  • achartengine一个布局中多条动态折线图实时更新效果
  • 个折线图中条折线。由于折线之间数值范围相差较大(折线A范围[0-50],折线B范围[10000-20000]……),如果用单Y轴来表示,折线的变化趋势不明显。 解决方案 1、最开始想到的是Y轴方式,每个折线对应一个Y轴 ...
  • (4)matplotlib下,一个figure对象可以包含多个子图(Axes),使用subplot()快速绘制。 plt.figure(figsize=(16,14),dpi=98) xmajorLocator = MultipleLocator(1) plt.rcParams['font.sans-serif']=['...
  • 遇到一个需求:折线图上最后一个一个动态水波纹的点。。。 一开始想让 UI小哥做一个 gif动态图,直接加到 echarts折线图的拐点上,但是小哥说 gif的画质太差,不给用,切成了一系列的静态图,让自己组装成动态...
  • Origin | 一个X对应多个Y的折线图

    万次阅读 2019-04-07 12:04:59
    用edu邮箱注册可以免费试用半年 首先打开软件是这样 点击文件->新建->项目 选择 Blank Workbook ...选中数据 点击左下角 折线图 画图成功 选择 文件->导出图形 可以选择.eps或者.pdf ...
  • 多个JS+Json柱状图饼图折线图示例

    热门讨论 2013-01-28 15:11:21
    多个JS+Json柱状图饼图折线图示例,前后端交互可参考本人博客!
  • python 用matplotlib画一个折线图

    千次阅读 2019-10-03 14:23:55
    # 生成一个 等差数列 ,从0.5 ~ 7.5之间包括 0.5,7.5有1000个元素的数组 x = np.linspace(0.5, 7.5, 1000) # 对ndarray类型x 进行矢量运算 y = np.sin(x) import matplotlib.pyplot as plt # 创建图形并设置大小 ...
  • echarts折线图默认显示最后一个点的数据 想要达到这种效果图如下: 如果你给折线图设置数据显示,那么要不就全部隐藏,要不就全部显示折线上。实现指定点的显示就需要你自己去处理这个数据了。 方式有两种: 方法...
  • echarts多个折线图

    千次阅读 2019-11-07 08:41:32
    option = { xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { type: 'value' }, tooltip: { trigger: ...
  • Y轴折线图

    2014-07-31 13:53:17
    jsp 页面的Y轴折线图制作案例附有实例及效果图片
  • Matlab绘制多个折线图的方法

    千次阅读 2021-06-29 00:11:22
    给出一个Matlab绘制折线图的例子:Matlab绘制多个折线图和子图的详细方法,并且字体设置为Times New Roman,可用于普通课程作业的撰写。 %% 维数选择 % 人脸1.f Dim = 10:10:100; %% 数据选择 % 人脸1.f RKSH = [53 ...
  • 如何达成这个折线图的效果 我们画页面时对于数据的展现,对于初学者,怎么更好的展现数据是困难的,这里将会提供一个简单的办法来展现数据的方式。 Highcharts 的优势 Highcharts 完全基于 HTML5 技术,不需要...
  • 在做项目时遇到一个需求,要使用主要数据,与气温和降水量做折线图横向对比。这里的问题在于:超过3种计量单位的数据做折线图的话,因为Y轴的计量单位得不同,也就是得有3个以上的Y轴。所以主要数据和其中一个对比...
  • Canvas之画多个折线图

    千次阅读 2017-06-14 20:51:26
    使用html画多个折线图,效果图如下: 二,代码片段(完整的代码文章的最后) var a_canvas; var a_context; var b_canvas; var b_context; window.onload = function() { a_canvas = ...
  • Android复式折线图,即表格折线图,可支持条折线显示 基于IDEA的项目源码
  • 用于SVG绘制折线图的库。 写所有榆树。 参见 安装 项目的根目录运行以下命令 $ elm install terezka/line-charts 并将库导入到这样的elm文件 import LineChart 有关使用的更信息,请参见文档! 文献...
  • 绘制折线图 如果将散点图上的点从左往右连接起来,就会得到一个折线图。今天我们以R自带的Orange 数据集为例,来学习折线图的画法,该数据集中包含五种橘树的树龄和年轮数据。要考察橘树的年轮如何随着树龄变化,...
  • Qchart设定多个不同刻度的Y轴 修改自定义折线图的坐标轴 改变折线图的底色,底色透明 import datetime import sys from PyQt5 import QtWidgets, QtCore from PyQt5.QtCore import Qt from PyQt5.QtGui ...
  • excel用户制作表格的过程,有时候为了更加凸显数据的走势变化,就需要用到折线图了,大多数用户使用折线图都是直接插入使用,那么怎么插入折线图呢?方法很简单,下面小编为大家带来excel插入折线图的详细...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 46,581
精华内容 18,632
热门标签
关键字:

如何在一个图中做多个折线图