吐槽

matlab 与 matplotlib绘图

  • 二维绘图

  • #matlab
    plot(x,y,'linewidth',3,'r');
    xlabel('x','fontsize',20,'fontname','Courier')
    ylabel('y','fontweight','bold');
    #设置坐标范围
    axis([xmin xmax ymin ymax])


    ##matplotlib绘图
    import numpy as np
    import matplotlib.pyplot as plt
    plt.figure()
    ax=plt.plot(x,y)
    ax.set_xlabel('f1')
    ax.set_ylabel('f2')
    ax.set_xlim(0,0.8)
    ax.set_ylim(0,0.8)

  • 三维绘图

  • #matlab绘图
    plot3(a1,a2,a3,'linewidth',3,'r');
    xlabel('x','fontsize',20,'fontname','Courier')
    ylabel('y','fontweight','bold');
    Zlabel('y','fontweight','bold');
    axis([xmin xmax ymin ymax zmin zmax])


    ##matplotlib绘图
    import numpy as np
    import matplotlib.pyplot as plt
    from mpl_toolkits.mplot3d import Axes3D
    import pandas as pd
    file=pd.read_excel('ok.xlsx',has_index_names=None)
    c1,c2,c3=file.c1,file.c2,file.c3
    fig=plt.figure()
    ax=fig.add_subplot(111,projection='3d')
    ax.scatter(c1,c2,c3,c='r',marker='o')
    ax.set_xlabel('f1')
    ax.set_ylabel('f2')
    ax.set_zlabel('f3')
    ax.set_xlim(0,0.8)
    ax.set_ylim(0,0.8)
    ax.set_zlim(0,6)
    plt.show()