matplot: quiver

Arrow plot (function quiver)

Code:


var i,j,x=[],y=[],u=[], v=[];

// generate some data to plot
for (i=0; i < 30; i++) {
  x[i] = [];
  y[i] = [];
  u[i] = [];
  v[i] = [];

  for (j=0; j < 30; j++) {
    x[i][j] = i-15
    y[i][j] = j-15
    u[i][j] = -y[i][j]
    v[i][j] = x[i][j]
  }
}

fig = new matplot.Figure("plot",700,500, {renderer: matplot.RasterCanvas});
ax = fig.axes();
//ax.quiver(x,y,u,v,{scale: 0.1,color: 'green'});
ax.quiver(x,y,u,v,{scale: 0.1,color: 'norm'});
ax.DataAspectRatio([1,1,1]);
ax.colorbar();

fig.draw();