On 03/23/2010 12:48 PM, John K. Williams wrote:
Hello, I'm having some trouble getting things to look as I want with
filled.contour.

1.  My first issue is that I am unable to add line segments to my plot where
I want them.  Using the rug pattern example:
x<- y<- seq(-4*pi, 4*pi, len = 27);
r<- sqrt(outer(x^2, y^2, "+"));
filled.contour(cos(r^2)*exp(-r/(2*pi)));
segments(0.2,0.2,1,0.2);
The line segment is not found in relation to the x-axis but is seemingly
squished over by the color bar.

If I try to achieve the line this way:
filled.contour(cos(r^2)*exp(-r/(2*pi)),plot.axes={lines(c(0.2,1),c(0.2,0.2))})
Now when I add the axis back it is misaligned.
axis(1).

2. Secondly I'm finding the literature difficult to understand on how to
make a nice color scheme.  Below is a nice scheme I found from an example,
except I don't understand why the scale seems to cycle into blue again for
larger values, even though I think I am setting the number of levels of
colors and contour levels to be equal.  Basically I want reds for the
highest values and blues for the lowest:
filled.contour(cos(r^2)*exp(-r/(2*pi)),nlevels=25,col=hsv(h=seq(from=.7,to=0,length=25)))

3.  I'm used to working with matlab where it was simple to make the color
scale the same on multiple figures using caxis().  However I don't see this
option for filled.contour (possibly it exists for levelplot() but I was
having even less success understanding that one).  I only see the option to
set the number of levels which doesn't really accomplish what I want for
plots that are going to have widely varying limits.

Hi John,
I'm not sure that this is what you want, but the examples for the barp function in the plotrix package include one for a color scale that extends beyond the values that are to be plotted. That is, you can specify the range of the color scale regardless of the actual values.

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.

Reply via email to