[R] contour

Rui Barradas ruipbarradas at sapo.pt
Wed Jul 18 13:04:23 CEST 2012


Hello,

Now I don't understand. Inline

Em 18-07-2012 11:56, Akhil dua escreveu:
> why are you writing ncol=2 ?
>
> I have levels=100 for x1 and the x1 is my z matrix
>

In your contour instruction x3 is the z matrix, not x1. And your dataset 
shows a 2x3 grid, hence ncol=2, for (x1 times x2) 0:1x1:3.

Also, see Eik's post, lattic graphics clearly are more intuitive.

Rui Barradas

>
>
> On Wed, Jul 18, 2012 at 3:46 PM, Rui Barradas <ruipbarradas at sapo.pt
> <mailto:ruipbarradas at sapo.pt>> wrote:
>
>     Hello,
>
>     Follow the code below and see what's the right way:
>
>
>     d <- read.table(text="
>
>     x1 x2 x3
>     0   1    2
>     0   2    1
>     0   3    5
>     1   1    4
>     1   2    2
>     1   3    3
>     ", header=TRUE)
>
>     x3 <- matrix(d[, "x3"], ncol=2)
>     levels <- sort(unique(x3))
>     contour(0:1, 1:3, t(x3), levels=levels)
>
>
>     Hope this helps,
>
>     Rui Barradas
>
>     Em 18-07-2012 10:23, Akhil dua escreveu:
>
>         Hello Everyone
>
>         I have the data long format and I want to draw the contour plot
>         with it
>
>         x1 x2 x3
>         0   1    2
>         0   2    1
>         0   3    5
>         1   1    4
>         1   2    2
>         1   3    3
>
>
>         when I am using contour(x1,x2,x3,col=heat.__colors) or fill.contour
>         its giving me an error that increasing x and y expected
>
>
>         So please tell me what is the right function to draw contour
>         when the data
>         is not ordered and you cant order it.
>
>                  [[alternative HTML version deleted]]
>
>         ________________________________________________
>         R-help at r-project.org <mailto:R-help at r-project.org> mailing list
>         https://stat.ethz.ch/mailman/__listinfo/r-help
>         <https://stat.ethz.ch/mailman/listinfo/r-help>
>         PLEASE do read the posting guide
>         http://www.R-project.org/__posting-guide.html
>         <http://www.R-project.org/posting-guide.html>
>         and provide commented, minimal, self-contained, reproducible code.
>
>
>



More information about the R-help mailing list