Data Plot

  • Let 2 plot show in one figure
octave:1> t = [0: 0.01: 0.98];
octave:2> y1 = sin(2 * pi * 4 * t);
octave:3> y2 = cos(2 * pi * 4 * t);
octave:4> plot(t, y1);
  [Bookmarked Mar 24, 2019 at 15:33:52]
octave:5> hold on                              %to hold the current plot not to be overwrite
octave:6> plot(t, y2);
octave:7> xlabel('time')                       %Add a label in x axis
octave:8> ylabel('value')                      %Add a label in y axis
octave:9> title('my plot')                     %Add a title
octave:10> legend('sin', 'cos')                %Add a legend
octave:11> cd 'Downloads'
octave:12> print -dpng 'myplot.png'            %output the plot
octave:13> close                               %close previewer

myplot.png

  • Output 2 figure
octave:14> figure(1); plot(t, y1);
octave:15> figure(2); plot(t, y2);
  • subplot
octave:27> subplot(1, 2, 1);       %divides plot in 1 * 2 grid, access the first element
octave:29> plot(t, y1);
octave:30> title('sin');
octave:31> subplot(1, 2, 2);       %divides plot in 1 * 2 grid, access the second element
octave:32> plot(t, y2, 'r');
octave:33> title('cos');
octave:34> print -dpng 'my subplot.png'
octave:35> close
my subplot.png
  • axis: to range the axis in the figure:

axis(xmin, xmax, ymin, ymax)

  • clf: clear a figure

  • Print a figure stand a matrix(different color stand for different value)

octave:42> A = magic(15);
octave:45> imagesc(A), colorbar, colormap  gray;
octave:46> print -dpng 'imagesc.png'
imagesc.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,449评论 0 10
  • 天子回头的天回镇,有一家专卖面条的豆花面店。 这家店的面条是一直不断地往锅里丢下去煮的。只要有人来,老板只问一句:...
    冯俊龙阅读 386评论 0 5
  • 昨天说了父亲节,今天干脆再来说说端午节。 一个星期前,微信好友群里就有人开始在晒买粽子、...
    耕牛1949阅读 397评论 0 5
  • 残种吐芯春露暖 翠叶摇阴夏日长 落花弄泥秋风劲 苍雪撩梅冬月寒
    默默磨墨s阅读 98评论 0 1
  • 01 总的来说,电影讲述了一个“不作死就不会死”,最后“作死”了的故事。 套路化的爱情,模式化的情感知觉,到底是不...
    溦汐阅读 356评论 0 1