[R] Contour

Duncan Murdoch murdoch.duncan at gmail.com
Thu Jul 19 13:50:37 CEST 2012


On 12-07-19 2:01 AM, Akhil dua wrote:
> Hello every one
> can any one tell me how to draw contour with this  data set
>
>
>    c           z        shock
>   1  0.45450237      0
>   2  0.02663337      0
>   3 -2.08444556      0
>   4 -0.12715275      0
>   5  0.67066360      0
>   6 -0.73540081      0
>
> I want to draw contour for shock i.e my z matrix is shock
>
> when I am applying contour its giving me error : increasing x and y are
> expected
> when I am applying contourplot its giving me error : no applicable method
> for contour plot applied to an object of class "c('double','numeric')"

The contour function wants the data to be in a grid.  You need to fit a 
function to your data (which is pretty easy if the response is always 
zero!), and then evaluate it at a grid of c and z values.

Duncan Murdoch



More information about the R-help mailing list