zoukankan      html  css  js  c++  java
  • python绘图问题

    论文绘图整理

    # coding: utf-8

    #来源:https://blog.csdn.net/A_Z666666/article/details/81165123


    import matplotlib.pyplot as plt

    # figsize = 11, 9
    # figure, ax = plt.subplots(figsize = figsize)
    x1 =[0,5000,10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000]
    y1=[0, 223, 488, 673, 870, 1027, 1193, 1407, 1609, 1791, 2113, 2388]
    x2 = [0, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000]
    y2 = [0, 214, 445, 627, 800, 956, 1090, 1281, 1489, 1625, 1896, 2151]

    # 设置输出的图片大小
    figsize = 11, 9
    figure, ax = plt.subplots(figsize=figsize)

    # 在同一幅图片上画两条折线
    A, = plt.plot(x1, y1, '-r', label='A', linewidth=5.0)
    B, = plt.plot(x2, y2, 'b-.', label='B', linewidth=5.0)

    # 设置图例并且设置图例的字体及大小
    font1 = {'family': 'Times New Roman',
             'weight': 'normal',
             'size': 23,
             }
    legend = plt.legend(handles=[A, B], prop=font1)

    # 设置坐标刻度值的大小以及刻度值的字体
    plt.tick_params(labelsize=23)
    labels = ax.get_xticklabels() + ax.get_yticklabels()
    # print labels
    [label.set_fontname('Times New Roman') for label in labels]
    # 设置横纵坐标的名称以及对应字体格式
    font2 = {'family': 'Times New Roman',
             'weight': 'normal',
             'size': 30,
             }
    plt.xlabel('round', font2)
    plt.ylabel('value', font2)
    plt.show()

    、、、、、、、、、、、、、、、、、

    关于图片的长宽比设定

    plt.figure(figsize=[16,8])                                             #这个是图片的长宽比。

    、、、、、、、、、、、、、、、、

    关于坐标调整

    、、、、、、、、、、、、、、、、

    import matplotlib.pyplot as plt

    x1 = [1, 2, 3]

    y1 = [1, 4, 9]

    x2 = [1, 2, 3]

    y2 = [5, 6, 7]

    plt.plot(x1, y1, label='y=x*x')

    plt.plot(x2, y2, label='y=x+4')

    plt.xlabel('input number')

    plt.ylabel('ouput number')

    plt.title('测试某些函数')

    plt.legend()

    plt.show()
    ---------------------
    作者:xjl271314
    来源:CSDN
    原文:https://blog.csdn.net/xjl271314/article/details/80291284
    版权声明:本文为博主原创文章,转载请附上博文链接!

    、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

    关于图例的设置

    https://blog.csdn.net/u012735708/article/details/82114565   里面有很好的信息。

    plt.legend(bbox_to_anchor=(1., 1.02, 1., .102),ncol=6,loc=1,prop=font1)  # 让图例生效  【这个应当添加上内容才是,】ncol代表了图例的列数

    https://blog.csdn.net/u010358304/article/details/78906768#在同一幅图片上画两条折线
    A,=plt.plot(x1,y1,'-r',label='A',linewidth=5.0)
    B,=plt.plot(x2,y2,'b-.',label='B',linewidth=5.0)
     
    #设置图例并且设置图例的字体及大小
    font1 = {'family' : 'Times New Roman',
    'weight' : 'normal',
    'size'   : 23,
    }
    legend = plt.legend(handles=[A,B],prop=font1)
    ---------------------
    作者:CAM-TAY
    来源:CSDN
    原文:https://blog.csdn.net/u010358304/article/details/78906768
    版权声明:本文为博主原创文章

    、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

    http://www.cnblogs.com/awishfullyway/p/6124668.html  问题汇总

  • 相关阅读:
    查询SQL数据库中表占用资源情况的语句
    修改VMware网卡MAC的方法
    Ajax 与 .net Validator
    控件属性值绑定到数据
    一个设计的小例子警察抓小偷
    加密Web.config 文件中的敏感信息
    VS .Net 2005程序集换名之后的遗留问题
    为ASP.Net 创建和配置应用程序服务数据库
    ArcGIS 9.0 在Windows XP SP2 上安装的问题(数据保护造成的)
    使用客户端脚本
  • 原文地址:https://www.cnblogs.com/chulin/p/10516568.html
Copyright © 2011-2022 走看看