0

I have created two raster stacks and would like to plot a row or column of pixels through the stack, but am not sure how to approach this.

I know I can subset by layer, but how do I subset vertically through the stack at a specific pixel location?

# Subsetted stack by layer
> tr_sub <- subset(tr_stack, 1:10) 
1

This is what the raster::extract function does, and it can extract values from a stack by cell number, or x-y coordinate.

See help(extract) for more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.