|
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')" [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
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 ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
|
In reply to this post by Akhil dua
As Duncan Murdoch pointed out, the example data frame that you provided
doesn't give very interesting results (all the shock values are zero), so I created a different shock variable for illustration. I suggest using the interp() function in the R package akima. df <- structure(list(c = 1:6, z = c(0.45450237, 0.02663337, -2.08444556, -0.12715275, 0.6706636, -0.73540081), shock = c(0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("c", "z", "shock"), class = "data.frame", row.names = c(NA, -6L)) df$shock2 <- df$c + df$z + df$z^2 library(akima) contour(interp(df$c, df$z, df$shock2)) Jean Akhil dua <[hidden email]> wrote on 07/19/2012 01:01:54 AM: > 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 > for contour plot applied to an object of class "c('double','numeric')" [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. |
| Powered by Nabble | Edit this page |
