Derivative of a two dimensial function in R

I have z a two dimension vector and I would like to plot the slope of this grid at each point.

Basically I have this grid : and I would like to have a new grid more like this :

The z vector :

z <- structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0734748404334273, 
0.0955420315669685, 0.0999455741922715, 0.101182524367918, 0.101380436396022, 
0.101429914403048, 0.101429914403048, 0.101429914403048, 0.101429914403048, 
0.101429914403048, 0, 0.0934144772648558, 0.156993716293108, 
0.185690960368116, 0.198208896145663, 0.201919746672604, 0.202513482756915, 
0.202760872792044, 0.202859828806096, 0.202859828806096, 0.202859828806096, 
0, 0.098956014051754, 0.185443570332987, 0.24625204096779, 0.281035079906981, 
0.293998317747761, 0.297313344218495, 0.298006036316857, 0.298203948344961, 
0.298253426351987, 0.298253426351987, 0, 0.100341398248479, 0.195932907822473, 
0.280243431794567, 0.3483746474692, 0.385384196724556, 0.396269358270249, 
0.399683340755034, 0.400376032853397, 0.400425510860423, 0.400425510860423, 
0, 0.100885656325763, 0.200484884468854, 0.292761367572114, 0.381129088120331, 
0.450002473900351, 0.483647518677948, 0.495126416307951, 0.498194052743555, 
0.498787788827866, 0.498787788827866, 0, 0.100885656325763, 0.202018702686656, 
0.297956558309831, 0.394785018059473, 0.484983424867646, 0.55093760823314, 
0.584087872940478, 0.595814160605611, 0.598436494977982, 0.598634407006086, 
0, 0.101034090346841, 0.202315570728811, 0.29929246449953, 0.39889169264262, 
0.496709712532779, 0.58166345059621, 0.648112414031963, 0.684577705210034, 
0.696650338924348, 0.69818415714215, 0, 0.101034090346841, 0.202365048735837, 
0.299539854534659, 0.399485428726931, 0.500519519073772, 0.59606155064074, 
0.68715056157538, 0.757607243580229, 0.794122012765326, 0.801246845777052, 
0, 0.101034090346841, 0.202365048735837, 0.299539854534659, 0.39973281876206, 
0.501162733165108, 0.5994260551185, 0.69927267329672, 0.79179654643511, 
0.867596853198753, 0.900549205877987, 0, 0.101034090346841, 0.202365048735837, 
0.299539854534659, 0.39973281876206, 0.501311167186186, 0.600069269209836, 
0.702587699767453, 0.801791103854337, 0.900747117906091, 1), .Dim = c(11L, 
11L))

Answers


There are functions in the raster package for computing slope and aspect of a raster (gridded) object. See help(terrain) for details.


Need Your Help

Is there a plugin that ties Jenkins' builds to Maven (Nexus) artifacts

maven nexus hudson-plugins jenkins-plugins

I was wondering if there is a Hudson/Jenkins plugin that ties repository artifacts to the build that created them? I was looking at the question "remove artifacts from nexus repository" and thinking

ng-grid tabbing out of an editable select cell retains previous typeahead value

javascript angularjs ng-grid

I have a grid that has a select for a editableCellTemplate when I follow these steps: