UCSBCarpentry / 2022-08-09-ucsb-r-geospatial

This is the repo for UCSB Lib's R Geospatial workshop on August 9 and 11, 2022
https://ucsbcarpentry.github.io/2022-08-09-ucsb-r-geospatial/
Other
0 stars 0 forks source link

Ep 11. Naming inconsistency #16

Open djhunter opened 2 years ago

djhunter commented 2 years ago

ggplot() + geom_raster(data = HARV_CHM_df, aes(x = x, y = y, fill = HARV_chmCrop)) + scale_fill_gradientn(name = "Canopy Height", colors = terrain.colors(10)) + geom_sf(data = aoi_boundary_HARV, color = "blue", fill = NA) + coord_sf()

Should be:

ggplot() +
  geom_raster(data = HARV_CHM_df, aes(x = x, y = y, fill = layer)) + 
  scale_fill_gradientn(name = "Canopy Height", colors = terrain.colors(10)) +
  geom_sf(data = aoi_boundary_HARV, color = "blue", fill = NA) +
  coord_sf()
djhunter commented 2 years ago

And later ggplot() + geom_sf(data = st_as_sfc(st_bbox(HARV_CHM)), fill = "green", color = "green", alpha = .2) +
geom_raster(data = HARV_CHM_Cropped_df, aes(x = x, y = y, fill = HARV_chmCrop)) + scale_fill_gradientn(name = "Canopy Height", colors = terrain.colors(10)) + coord_sf()

should be:

ggplot() +
  geom_sf(data = st_as_sfc(st_bbox(HARV_CHM)), fill = "green",
          color = "green", alpha = .2) +  
  geom_raster(data = HARV_CHM_Cropped_df,
              aes(x = x, y = y, fill = layer)) + 
  scale_fill_gradientn(name = "Canopy Height", colors = terrain.colors(10)) + 
  coord_sf()
djhunter commented 2 years ago

and again ggplot() + geom_sf(data = st_as_sfc(st_bbox(HARV_CHM)), fill = "green", color = "green", alpha = .2) +
geom_raster(data = HARV_CHM_Cropped_df, aes(x = x, y = y, fill = HARV_chmCrop)) + scale_fill_gradientn(name = "Canopy Height", colors = terrain.colors(10)) + coord_sf()

should be

ggplot() +
  geom_sf(data = st_as_sfc(st_bbox(HARV_CHM)), fill = "green",
          color = "green", alpha = .2) +  
  geom_raster(data = HARV_CHM_Cropped_df,
              aes(x = x, y = y, fill = layer)) + 
  scale_fill_gradientn(name = "Canopy Height", colors = terrain.colors(10)) + 
  coord_sf()