Re: [R] Problem with colors in contour plot

2012-10-05 Thread Jim Lemon

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

__
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.


Re: [R] Problem with colors in contour plot

2012-10-05 Thread Loukia Spineli
Thank you very much Jim!!!

Your function achieves to color the grid tha way I want, but it can handle
only one variable, if I have understood correctly the details of this
function.The plot must display in the axes percentages and in the grids
pvalues. I have incorporated 3 different variables in a contourplot.

On Fri, Oct 5, 2012 at 12:08 PM, Jim Lemon j...@bitwrit.com.au wrote:

 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


[[alternative HTML version deleted]]

__
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.


[R] Problem with colors in contour plot

2012-10-04 Thread Loukia Spineli
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.


Re: [R] Problem with colors in contour plot

2012-10-04 Thread Rui Barradas
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]]

__
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.


Re: [R] Problem with colors in contour plot

2012-10-04 Thread Loukia Spineli
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 ruipbarra...@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-h...@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.



__
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.


Re: [R] problem with colors

2010-10-09 Thread ANJAN PURKAYASTHA
Hi Phil and Thomas,
Thanks for your helpful feedback.  I must admit my solution to creating the
vector of colors lacked your elegance.
In brief, I saved the output of colors() into a text file, saved all but 47
colours in that file and read it back as a data frame and used the first
column of the dataframe as a vector of 47 colours. This roundabout method
may have caused the  problem because when I chose colours according to the
commands sent by both of you things seemed to work just fine.
Thank you very much for your feedback.
Anjan

On Thu, Oct 7, 2010 at 3:25 PM, Thomas Stewart tgstew...@gmail.com wrote:

 I would be helpful if you provided a more complete, reproducible example.
  Consider the following code.  It colors the boxes according to the first 47
 colors listed in the color() vector.

 -tgs

 data-as.data.frame(matrix(rnorm(47*23),ncol=47))
 boxplot(data,col=colors()[1:47])




 On Thu, Oct 7, 2010 at 2:22 PM, ANJAN PURKAYASTHA 
 anjan.purkayas...@gmail.com wrote:

 Hi,
 I have a data set of 47 columns. I would like to create a boxplot for each
 column, each boxplot of a different colour.
 So I created a vector col1. This vector has a subset of the colors
 returned by color()- red, cyan, green etc.
 Now I use the command: boxplot(dataset, col= col1) expecting to see 47
 boxplots, each of a different colour.
 Here is the problem: the boxplots are drawn correctly but it seems that
 only
 the first few colours in col1 are being used in a repeated pattern.
 Anybody has any ideas on how to tackle this?
 Thanks in advance,
 Anjan

 --
 ===
 anjan purkayastha, phd.
 research associate
 fas center for systems biology,
 harvard university
 52 oxford street
 cambridge ma 02138
 phone-703.740.6939
 ===

[[alternative HTML version deleted]]

 __
 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.





-- 
===
anjan purkayastha, phd.
research associate
fas center for systems biology,
harvard university
52 oxford street
cambridge ma 02138
phone-703.740.6939
===

[[alternative HTML version deleted]]

__
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.


[R] problem with colors

2010-10-07 Thread ANJAN PURKAYASTHA
Hi,
I have a data set of 47 columns. I would like to create a boxplot for each
column, each boxplot of a different colour.
So I created a vector col1. This vector has a subset of the colors
returned by color()- red, cyan, green etc.
Now I use the command: boxplot(dataset, col= col1) expecting to see 47
boxplots, each of a different colour.
Here is the problem: the boxplots are drawn correctly but it seems that only
the first few colours in col1 are being used in a repeated pattern.
Anybody has any ideas on how to tackle this?
Thanks in advance,
Anjan

-- 
===
anjan purkayastha, phd.
research associate
fas center for systems biology,
harvard university
52 oxford street
cambridge ma 02138
phone-703.740.6939
===

[[alternative HTML version deleted]]

__
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.


Re: [R] problem with colors

2010-10-07 Thread Phil Spector

Anjan -
   I think you'll need to give us more information -- I can't
reproduce the problem.  For example,


dat = data.frame(matrix(rnorm(47000),100,47))
cols = sample(colors(),47)
boxplot(dat,col=cols)


doesn't repeat any of the colors in cols.
- Phil


On Thu, 7 Oct 2010, ANJAN PURKAYASTHA wrote:


Hi,
I have a data set of 47 columns. I would like to create a boxplot for each
column, each boxplot of a different colour.
So I created a vector col1. This vector has a subset of the colors
returned by color()- red, cyan, green etc.
Now I use the command: boxplot(dataset, col= col1) expecting to see 47
boxplots, each of a different colour.
Here is the problem: the boxplots are drawn correctly but it seems that only
the first few colours in col1 are being used in a repeated pattern.
Anybody has any ideas on how to tackle this?
Thanks in advance,
Anjan

--
===
anjan purkayastha, phd.
research associate
fas center for systems biology,
harvard university
52 oxford street
cambridge ma 02138
phone-703.740.6939
===

[[alternative HTML version deleted]]

__
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.



__
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.


Re: [R] problem with colors

2010-10-07 Thread Thomas Stewart
I would be helpful if you provided a more complete, reproducible example.
 Consider the following code.  It colors the boxes according to the first 47
colors listed in the color() vector.

-tgs

data-as.data.frame(matrix(rnorm(47*23),ncol=47))
boxplot(data,col=colors()[1:47])




On Thu, Oct 7, 2010 at 2:22 PM, ANJAN PURKAYASTHA 
anjan.purkayas...@gmail.com wrote:

 Hi,
 I have a data set of 47 columns. I would like to create a boxplot for each
 column, each boxplot of a different colour.
 So I created a vector col1. This vector has a subset of the colors
 returned by color()- red, cyan, green etc.
 Now I use the command: boxplot(dataset, col= col1) expecting to see 47
 boxplots, each of a different colour.
 Here is the problem: the boxplots are drawn correctly but it seems that
 only
 the first few colours in col1 are being used in a repeated pattern.
 Anybody has any ideas on how to tackle this?
 Thanks in advance,
 Anjan

 --
 ===
 anjan purkayastha, phd.
 research associate
 fas center for systems biology,
 harvard university
 52 oxford street
 cambridge ma 02138
 phone-703.740.6939
 ===

[[alternative HTML version deleted]]

 __
 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]]

__
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.