Skip to content

Latest commit

 

History

History
122 lines (99 loc) · 1.59 KB

File metadata and controls

122 lines (99 loc) · 1.59 KB

PlotHelper

Dependencies
Gnuplot added to PATH
Dart interpreter added to PATH
  • Usage

See examples below

  • Options

Depending on the type of graph, optional parameters can be passed, like linewidth, labels, colors, output format...


Examples

  • Simplest graph
main() {
  plot('x^2');
}

x^2

Now with some options :

main() {
  plot('x^2',
    style:Styles.impulses,
    nbPoints:2000,
    color:'purple',
    showGrid:true
  );
}

x^2_2

  • Multiple plots
main() {
  multiplot(
    [
      new Plot(
        '1/x',
        style:Styles.steps,
        showGrid:true
      ), 
      new Plot(
        'log(x)',
        style:Styles.impulses,
        color:'red',
        frm:0,
        to:2
      )
    ],
    rows:2
  );
}

outMulti

  • 3D plot
main() {
  plot3d(
      'cos(x)*sin(y)',
      palette:Palettes.ocean,
      labels:new Labels(
        xlabel: 'x axis',
        ylabel: 'y axis',
        zlabel: 'z axis',
        title: '3D plot!'
      )
    );
}

out3d

  • Plot from a file
main() {
  plot3d(
    'plt.dat',
    file:true 
  );
}

file

  • Bode plot
main() {
  bode('(1-s)/((1+s)*(1-2*s))');
}

bode

main() {
  bode(
    fromCoefs(
      [2.008, 0, 0, 0, 0],
      [1, 1.307, 4.854, 4.249, 7.768, 4.249, 4.854, 1.307, 1]
    ),
    frm:1e-4,
    to:1e4
  );
}

bode_bandpass