On Wed, Dec 3, 2008 at 9:13 AM, Seth W Bigelow <[EMAIL PROTECTED]> wrote:
> I'm working on a contourplot( ) graph, the subject of several previous
> posts to this list. The contours express probabilities from 0 - 1, but the
> key that is automatically generated by contourplot pads the probability
> scale with values that are impossible (i.e, range goes from -0.2 to 1.2),
> which will be confusing to those who view the plot. How can I get the
> scale to just run from 0 - 1?
>
> I have toiled mightily in the depths of the Murrell & Sarkar graphics
> books. Any pointers will be gratefully received.
>
> --Seth
>
> Minimal, commented code:
>
> library(lattice)
>
> model <- function(a,b,c,d,e, f, X1,X2)          # model function for
> contour plot
> {J <- a + (b*X1) + (c*X2) + (d*X1*X2) + e*(X1^2) + f*(X2^2)
>  pp <- exp(J)/(1+exp(J))
>  return(pp)}
>
> g <- expand.grid(X1= seq(0.3,0.9,0.01), X2 = seq(0.3,1, 0.01))
> ## create x and y data matrix
>
> g$z <- model(-29, -14, 52, 80, -3, -56, g$X1, g$X2)
> ## Create variable z using model and g data frame
>
> contourplot(z ~ X1 * X2,
> data = g,
> region = TRUE,         # Add color to background
> cuts = 5            # Number of contour/color intervals.
> )

contourplot(z ~ X1 * X2, data = g, region = TRUE, at = seq(0, 1, length = 6))

-Deepayan

______________________________________________
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