[R] R lattice contourplot: select only specific values
w||||@mwdun|@p @end|ng |rom gm@||@com
Wed Nov 17 19:50:21 CET 2021
Try using at=c(1.8, 2.8) to specify the contour levels you want (and omit
the cuts= argument).
On Wed, Nov 17, 2021 at 5:41 AM Luigi Marongiu <marongiu.luigi using gmail.com>
> I have a dataframe of three variables: x, y, z. The value of z are:
> > unique(df$z)
>  1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.6 3.0 2.4 2.8
> I would like to plot the contour where the data get integer values
> (1.0, 2.0, 3.0) but also highlight where the 1.8 and 2.8 values
> occurred. Thus, I am plotting the data with lattice's contourplot with
> a cut of 3, and I would like to add a layer with the contours for the
> 2.8 values. A sort of mean and 95% CI margins around it.
> I selected a subset of the original dataframe, but it does not plot
> ds = subset(df, z == 1.8 | z == 2.8)
> a = contourplot(z ~ y*x, data = df, cuts = 3, lwd = 3, labels=FALSE)
> b = contourplot(Class ~ y*x, data = ds, lwd = 1, col="blue")
> P = a + as.layer(b)
> Is there a way to select only a subset of the contours? If I increase
> `cuts` I get more levels, I am only interested in certain values...
> Thank you
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help