Specific sections with coplot in r

I coded a coplot function to create a separated graph depending on z. First, is it possible to create graphs depending on specific section of z, say i want a section from 0 to 150, 150 to 200, 200 to 250 and so on?

all_pit_data<- read.table("ALL_PIT_DATA.csv",header=TRUE,sep=",")
cols <- terrain.colors(462)
windows()
coplot(all_pit_data$x1 ~ all_pit_data$y1 | all_pit_data$z1,
   number = 9,
   overlap = 0,
   col = cols[all_pit_data$z1],
   xlab= c("x", "z"), 
   ylab="y")

Second, I would like to obtain a color filling like on this picture. the filling depends on the z variable. Any idea how it is possible?

Answers


To answer your first question: The "given.values" argument in coplot lets you define the conditioning variable intervals (a in the formula y ~ x | a), but the input format is specific. It must be a matrix with 2 columns and n rows - the first column has the start points for each interval, and the second column has the ending points for each interval.

To break z into the intervals you stated above:

Create the matrix with the intervals:

given.z <- matrix(c(0, 150, 200, 250, 300, 350, 400, 450, 150, 200, 250, 300, 350, 400, 450, 500), nrow = 8, ncol = 2)

Create the plot:

coplot(x1 ~ y1 | z1, data = all_pit_data, given.values = given.z, xlab= c("x", "z"), ylab="y")

Need Your Help

How to do calc using two RasterStack ?

r raster r-raster

I have two Large Rasterstack (6000 each ). I would like to do some simple calculations such as

Why can't I open my bitmap file?

c# bitmap

I've created a project, added a reference to System.Drawing, and added a bmp file "screenshot003.bmp". I've r-clicked the bmp-file and brought up it's properties. I marked it as "Content". When I r...