AnesG
AnesG

Reputation: 275

Plot raster file

I have a dataframe in which values c are specified for Cartesian coordinates (x, y). I use plot() and the result has too much space in Y-axis. Is there a way to edit that?

library(raster)
x <- c(1:60)
y <- c(2:5)
c <- rnorm(60)
Data1 <- data.frame(x, y, c)
raster1 <- rasterFromXYZ(Data1)
plot(raster1)

enter image description here

Upvotes: 3

Views: 533

Answers (1)

Trey Roady
Trey Roady

Reputation: 27

While not a fix, it helps to note that in plot(), xlim and ylim end up providing the max and min.

Obviously, it's handled differently in the raster library. When I use plot(raster1, ylim=c(2,5)), the axis isn't adjusted at all. However, if you use plot(raster1, xlim=c(0,20)) clearly affects the x-axis.

I'm not sure why it won't affect the y-axis.

Upvotes: -1

Related Questions