Re: [R] filled.contour and NA's

2006-12-11 Thread hadley wickham
 I'm trying to do a filled.contour plot where some points are labelled as
 NA. How do I could plot this kind of graphics, so NA points are coloured
 black,  keeping the levels of remaining points. NA's values represent
 land points (meaningless), and what I want to plot is the levels of a
 variable over the sea.

You can also do this using ggplot, although you don't have quite as
much control over the appearance of the contours (you do get more
control over other things)

install.packages(ggplot, dep=T)
library(ggplot)

# Set up appropriate data structure
dimnames(ene) - list(y, x)
names(dimnames(ene)) - c(y, x)
enem - melt(ene)

p - ggplot(na.omit(enem), aes=list(x=x, y=y, z=value, fill=value))
p - ggtile(p)
p - ggcontour(p)
scfillgradient(p)
scfillgradient(p, low=white, high=blue)

Regards,

Hadley

__
R-help@stat.math.ethz.ch 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] filled.contour and NA's

2006-12-10 Thread Gustaf Rydevik
On 12/8/06, antonio rodriguez [EMAIL PROTECTED] wrote:
 Hi Gustaf

  I'm having the same issue myself. What I've ended up doing is
  replacing NA's with a big negative value, define levels as one color
  for negative values, and a regular scale above.

 How to define 'levels' as one color for negative values and a regular
 scale above? I don't know how the syntax within the filled.contour
 function shoul be.

 BR

 Antonio


Hi Antonio,

I just meant something like

filled.contours(x,y,x,levels=c(-1,seq(0,1,0.1)),color.palette=heat.colors)

This will give a fairly sharp delination for non-valid data, but still
using the same palette. If you want a totally distinct color, I
suppose you have to define your own palette  (And I don't know how to
do that)

/Gustaf

-- 
email:[EMAIL PROTECTED]
tel: +46(0)703051451
address: Kantorsgatan 50:190 75424 Uppsala Sweden

__
R-help@stat.math.ethz.ch 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] filled.contour and NA's

2006-12-08 Thread Gustaf Rydevik
On 11/29/06, antonio rodriguez [EMAIL PROTECTED] wrote:
 Hi,

 I'm trying to do a filled.contour plot where some points are labelled as
 NA. How do I could plot this kind of graphics, so NA points are coloured
 black,  keeping the levels of remaining points. NA's values represent
 land points (meaningless), and what I want to plot is the levels of a
 variable over the sea.


Hi Antonio,

I haven't seen a reply to your question yet, so I'll make a try.

I'm having the same issue myself. What I've ended up doing is
replacing NA's with a big negative value, define levels as one color
for negative values, and a regular scale above. This gives a fairly
good separation between what areas contain data, and what doesn't. To
make NA's black, I suppose one would have to define your own
colour.palette, but I haven't looked into it.

Hope this helps, and let me know if you've found a better solution!

Best,

Gustaf Rydevik

__
R-help@stat.math.ethz.ch 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] filled.contour and NA's

2006-12-08 Thread antonio rodriguez
Hi Gustaf

 I'm having the same issue myself. What I've ended up doing is
 replacing NA's with a big negative value, define levels as one color
 for negative values, and a regular scale above. 

How to define 'levels' as one color for negative values and a regular 
scale above? I don't know how the syntax within the filled.contour 
function shoul be.

BR

Antonio


 This gives a fairly
 good separation between what areas contain data, and what doesn't. To
 make NA's black, I suppose one would have to define your own
 colour.palette, but I haven't looked into it.

 Hope this helps, and let me know if you've found a better solution!

 Best,

 Gustaf Rydevik


__
R-help@stat.math.ethz.ch 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] filled.contour and NA's

2006-11-29 Thread antonio rodriguez
Hi,

I'm trying to do a filled.contour plot where some points are labelled as 
NA. How do I could plot this kind of graphics, so NA points are coloured 
black,  keeping the levels of remaining points. NA's values represent 
land points (meaningless), and what I want to plot is the levels of a 
variable over the sea.

x-seq(length=21, from=-10, by=.25)
y-seq(length=8, from=36, by=.25)

filled.contour(x,y,t(ene))

dput(ene,control=all)
structure(c(0.941176470588235, 0.705882352941177, 0.588235294117647,
0.470588235294118, 0.588235294117647, 0.588235294117647, 0.588235294117647,
0.705882352941177, 0.647058823529412, 0.823529411764706, 0.588235294117647,
0.588235294117647, 0.529411764705882, 0.647058823529412, 0.588235294117647,
0.764705882352941, 0.823529411764706, 0.764705882352941, 0.647058823529412,
0.705882352941177, 0.529411764705882, 0.647058823529412, 0.529411764705882,
0.529411764705882, 0.705882352941177, 0.647058823529412, 0.764705882352941,
0.705882352941177, 0.529411764705882, 0.705882352941177, 0.647058823529412,
0.411764705882353, 0.88235294117647, 0.823529411764706, 0.764705882352941,
0.764705882352941, 0.705882352941177, 0.647058823529412, 0.529411764705882,
0.529411764705882, 0.764705882352941, 0.941176470588235, 0.941176470588235,
0.88235294117647, 0.722, 0.588235294117647, 0.5625,
0.5, 0.823529411764706, 0.823529411764706, 0.833,
1, 0.529411764705882, 0.909090909090909, 0.818181818181818, 
1.33,
0.941176470588235, 0.88235294117647, 0.823529411764706, 0.833,
0.6, NA, NA, NA, 0.705882352941177, 0.88235294117647, 0.823529411764706,
0.722, 0.75, NA, NA, NA, 0.647058823529412, 0.705882352941177,
0.764705882352941, 0.722, 0.5, 1.67,
NA, NA, 0.529411764705882, 0.647058823529412, 0.647058823529412,
0.588235294117647, 1.17, 1.5, NA, NA, 0.529411764705882,
0.470588235294118, 0.588235294117647, 0.428571428571429, 1.33,
1.5, NA, NA, 0.470588235294118, 0.470588235294118, 0.529411764705882,
0.727272727272727, 1.67, 1.5, NA, NA, 0.470588235294118,
0.556, 0.588235294117647, 1.17, 1.67,
1.67, NA, NA, 0.611, 0.529411764705882,
0.583, 1.17, 1.17, NA, NA,
NA, 0.428571428571429, 0.875, 1.33, 1, 1.33,
NA, NA, NA, 0.833, 0.833, 1.5, 1.33,
NA, NA, NA, NA, 2.17, 1.67, NA, NA, NA,
NA, NA, NA, 1.5, 0.833, 0.5, NA, NA, NA, NA, NA,
0.667, 0.667, 1.17, NA, NA,
NA, NA, NA, 0.667, 0.667, 0.667,
NA, NA, NA, NA, NA), .Dim = as.integer(c(8, 21)))

__
R-help@stat.math.ethz.ch 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.