• 【matlab】plot



    plot
    2-D line plot
    Syntax
    plot(Y)
    plot(X1,Y1,...,Xn,Yn)
    plot(X1,Y1,LineSpec,...,Xn,Yn,LineSpec)
    plot(...,'PropertyName',PropertyValue,...)
    plot(axes_handle,...)
    h = plot(...)

    1、设置坐标字体(A

    set(gca,'FontSize',12);

    2、设置x轴标记文字(B

    xlabel('Frequency(Hz)','FontSize',14,'FontName','Times New Roman');

    ylabel('Amplitude(dB)','FontSize',14,'FontName','Times New Roman');

    3、设置绘图坐标显示范围

    axis([400 3000 -20 70]); % 其中400 3000是x轴最小和最大值;-20和70是y周最小和最大值

    4、设置绘图大小

    set(gcf,'Position',[200 200 350 250]);  % 其中(200,200)是绘图左下角坐标;

    % (350,250)是绘图右上角坐标。

    5、在图中标注(C

    text(1800,55,’m=0.4’,'FontSize',14);       % 在400,300位置添加标注m=0.4

    6、设置标题(D

    title(‘800Hz,sqrt0,1.0’);

    7、设置曲线的粗细

    set(findobj(get(gca,'Children'),'LineWidth',0.5),'LineWidth',1);  % 设置线条粗细

    8、存储绘图

    saveas(gcf,’test.emf’,'emf');   % 存储当前图像为test.emf。

    9、不显示绘图

    set(gcf,'visible','off');       % 不显示图片

    10、标注同一绘图中不同曲线

    legend('m=1.0',’m=0.8’);

    e.g.

    一、

    t1 = (0:11)/11*pi;
    y1 = sin(t1) .* sin(9*t1);
    t2 = (0:100) / 100 *pi;
    y2 = sin(t2) .* sin(9*t2);
    
    subplot(2,3,1)
    plot(t1,y1,'r.')
    
    subplot(2,3,4)
    plot(t2,y2,'r.')
    
    subplot(2,3,2)
    plot(t1,y1,'r')
    
    subplot(2,3,5)
    plot(t2,y2,'r')
    
    subplot(2,3,3)
    plot(t1,y1,t1,y1,'r.')
    
    
    subplot(2,3,6)
    plot(t1,y1,'g',t1,y1,'r.')

     二、

    plot(x,y,'r',x,y, 'ks','MarkerSize',7)

    三、

    A = load('result.txt');
    
    % for i = 0:0
    %     start = i*4 +1
    %     en = (i+1) *4
    %     x = A(start:en, 1)
    %     y = A(start:en, 2)
    % end
    figure
    hold on
    
    x = A(1:4,1);
    y = A(1:4,2);
    plot(x,y, '-ks','MarkerSize',7, 'LineWidth', 1)
    
    x = A(5:8,1);
    y = A(5:8,2);
    plot(x,y, '-m+','MarkerSize',7, 'LineWidth', 1)
    
    x = A(9:12,1);
    y = A(9:12,2);
    plot(x,y, '-bo','MarkerSize',7, 'LineWidth', 1)
    
    x = A(13:16,1);
    y = A(13:16,2);
    plot(x,y, '-yx','MarkerSize',7, 'LineWidth', 1)
    
    x = A(17:20,1);
    y = A(17:20,2);
    plot(x,y, '-rd','MarkerSize',7, 'LineWidth', 1)
    
    x = A(21:24,1);
    y = A(21:24,2);
    plot(x,y, '-c*','MarkerSize',7, 'LineWidth', 1)
    
    axis([0,500,0.66,0.74])
    grid on
    title('Warm Prediction')
    xlabel('Given'),ylabel('NMAE')
    legend('A','B','C','D','E','F')
    
    set(findobj(get(gca,'Children'),'LineWidth',1),'LineWidth',2);

  • 相关阅读:
    TJU ACMICPC 2009314
    TJU ACMICPC 2009313
    素数(Prime Number)
    Android学习系列(1)为App签名(为apk签名)
    Android学习系列(10)App列表之拖拽ListView(上)
    Android学习系列(6)App模块化及工程扩展
    Android学习系列(7)App消息通知机制
    Android学习系列(4)App自适应draw9patch不失真背景
    Android学习系列(9)App列表之分组ListView
    Android技术积累:图片缓存管理
  • 原文地址:https://www.cnblogs.com/549294286/p/3040286.html
Copyright © 2020-2023  润新知