Dear R users, I have a 51 by 51 matrix of p-values (named as pvalue_MA). I want to present graphically this matrix in a plot (filled contour plot) where both axes represent probabilities. I have also added a grid in this plot. I want to highlight in white the cells of the grid that represent p-values smaller than the (common) significance threshold, 0.05. The code from this plot is colored in blue (I had to copy-pasted all this code in order to reach to the plot). I suspect that the "problem" might be in the col parameter of the filled.contour function. Honestly, I cannot understand why the plot appears to be completely white!! I checked the values of my variable and it has a great range from 0 to 1. Any suggestion/ comment would really help me to move on with my project. All the best, Loukia
Hello, Something like this? myRamp <- colorRampPalette(c("lightblue", "darkblue")) mypal <- myRamp(20) mypal[1] <- rgb(1, 1, 1) #?filled.contour ## Persian Rug Art: x <- y <- seq(-4*pi, 4*pi, len = 27) r <- sqrt(outer(x^2, y^2, "+")) filled.contour(cos(r^2)^2, frame.plot = FALSE, plot.axes = {}, col = mypal) grid() Hope this helps, Rui Barradas Em 04-10-2012 13:25, Loukia Spineli escreveu:> Dear R users, > > I have a 51 by 51 matrix of p-values (named as pvalue_MA). I want to > present graphically this matrix in a plot (filled contour plot) where both > axes represent probabilities. I have also added a grid in this plot. I want > to highlight in white the cells of the grid that represent p-values smaller > than the (common) significance threshold, 0.05. The code from this plot is > colored in blue (I had to copy-pasted all this code in order to reach to > the plot). I suspect that the "problem" might be in the col parameter of > the filled.contour function. Honestly, I cannot understand why the plot > appears to be completely white!! I checked the values of my variable and it > has a great range from 0 to 1. > Any suggestion/ comment would really help me to move on with my project. > > All the best, > > Loukia > > > ______________________________________________ > R-help@r-project.org 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.[[alternative HTML version deleted]]
The contpour plot is very impressive!!! The contour plot I want to display should have only 2 colors: white a grey. I have created this plot for only one trial (see, ppts) and now I am attempting to do the same for many trials. On Thu, Oct 4, 2012 at 3:51 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:> Hello, > > Something like this? > > > myRamp <- colorRampPalette(c("lightblue", "darkblue")) > mypal <- myRamp(20) > mypal[1] <- rgb(1, 1, 1) > > #?filled.contour > ## Persian Rug Art: > x <- y <- seq(-4*pi, 4*pi, len = 27) > r <- sqrt(outer(x^2, y^2, "+")) > filled.contour(cos(r^2)^2, frame.plot = FALSE, > plot.axes = {}, col = mypal) > grid() > > > Hope this helps, > > Rui Barradas > Em 04-10-2012 13:25, Loukia Spineli escreveu: > > Dear R users, > > I have a 51 by 51 matrix of p-values (named as pvalue_MA). I want to > present graphically this matrix in a plot (filled contour plot) where both > axes represent probabilities. I have also added a grid in this plot. I want > to highlight in white the cells of the grid that represent p-values smaller > than the (common) significance threshold, 0.05. The code from this plot is > colored in blue (I had to copy-pasted all this code in order to reach to > the plot). I suspect that the "problem" might be in the col parameter of > the filled.contour function. Honestly, I cannot understand why the plot > appears to be completely white!! I checked the values of my variable and it > has a great range from 0 to 1. > Any suggestion/ comment would really help me to move on with my project. > > All the best, > > Loukia > > > > ______________________________________________R-help at r-project.org mailing listhttps://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 10/04/2012 10:25 PM, Loukia Spineli wrote:> Dear R users, > > I have a 51 by 51 matrix of p-values (named as pvalue_MA). I want to > present graphically this matrix in a plot (filled contour plot) where both > axes represent probabilities. I have also added a grid in this plot. I want > to highlight in white the cells of the grid that represent p-values smaller > than the (common) significance threshold, 0.05. The code from this plot is > colored in blue (I had to copy-pasted all this code in order to reach to > the plot). I suspect that the "problem" might be in the col parameter of > the filled.contour function. Honestly, I cannot understand why the plot > appears to be completely white!! I checked the values of my variable and it > has a great range from 0 to 1. > Any suggestion/ comment would really help me to move on with my project. >Hi Loukia, Do you really need a contour plot for this? pvals<-matrix(runif(2601),nrow=51) library(plotrix) pcols<-ifelse(pvals<=0.05,"white","gray") color2D.matplot(pvals,cellcolors=pcols) Jim