title: What is causing the error "Z matrix not specified" when making a graph of vectors
body: <p>I am making a graph for some vectors, and I have the following code (r script):</p>
  <h1>calculating the derivatives</h1>
  <pre><code>#calculating the derivatives
  #x direction`#x direction
  gradientx2d_dd=function(x,dx){}
  dd=uwind
  xdim=dd[1]
  ydim=dd[2]
  gradx=0.0*uwind
  for (i in 1:ydim){
  gradx[2:xdim,i]=diff(uwind[1:uwind,i])/dx}
  return(gradx)
  
  #y direction
  gradienty2d_dd=function(x,dy){}
  dd=uwind
  xdim=dd[1]
  ydim=dd[2]
  grady=0.0*uwind
  for (i in 1:xdim){
  grady[i,2:ydim]=diff(uwind[i, 1:ydim])/dy}
  return(grady)
  
  Divergence=gradientx2d_dd(uwind,dx)+gradienty2d_dd(uwind,dy)
  
  #plot divergence
  filled.contour(lon,lat,Divergence,zlim=c=
  (-10,10),nlevels=124,colour=rainbow, main=&quot;Mean wind Divergence&quot;,
  plot.axes={axis(1);axis(2);map(add=T)})
  </code></pre>
  <p>I know the error is within the y derivative section, which I have taken from a previous code where it worked. I have double, triple checked it, however it is saying that it cannot plot the graph, as the &quot;no proper 'z' matrix specified&quot;. However, I think I have specified it as divergence. I cannot figure out where I went wrong here.</p>