如何画具有多列的图例

手把手教学。

东西/原料

  • matlab
  • 电脑

方式/步调

  1. 1

    号令行键入:

    x = linspace(0,10);

    %界说x。

  2. 2

    号令行键入:

    y1 = sin(x);

    y2 = sin(0.9*x);

    y3 = sin(0.8*x);

    y4 = sin(0.7*x);

    y5 = sin(0.6*x);

    y6 = sin(0.5*x);

    %界说y1,y2,y3,y4,y5,y6。

  3. 3

    号令行键入:

    plot(x,y1,'DisplayName','sin(x)')

    %绘图。

  4. 4

    号令行键入:

    hold on

    %图形连结。

  5. 5

    号令行键入:

    plot(x,y2,'DisplayName','sin(0.9x)')

    plot(x,y3,'DisplayName','sin(0.8x)')

    plot(x,y4,'DisplayName','sin(0.7x)')

    plot(x,y5,'DisplayName','sin(0.6x)')

    plot(x,y6,'DisplayName','sin(0.5x)')

    %绘图。

  6. 6

    号令行键入:

    hold off

    %打消连结

  7. 7

    号令行键入:

    lgd = legend;

    %标签。

  8. 8

    号令行键入:

    lgd.NumColumns = 2;

    %经由过程将 NumColumns 属性设置为 2 来添加一个具有两列的图例。

    END
  • 发表于 2020-04-10 17:01
  • 阅读 ( 875 )
  • 分类:其他类型

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
admin
admin

0 篇文章

作家榜 »

  1. xiaonan123 189 文章
  2. 汤依妹儿 97 文章
  3. luogf229 46 文章
  4. jy02406749 45 文章
  5. 小凡 34 文章
  6. Daisy萌 32 文章
  7. 我的QQ3117863681 24 文章
  8. 华志健 23 文章

联系我们:uytrv@hotmail.com 问答工具