inst/examples/compare_sentinel_modis/new_scripts/other/cloud_histogram.R

libaray(dplyr)
libaray(raster)

r <- "/home/alber/Documents/data/experiments/prodes_reproduction/papers/deforestation/plot/cloud_frequency.tif"

data <- r %>% 
    raster::raster() %>% 
    .[] %>% 
    table()

data %>% 
    as.data.frame(stringsAsFactors = FALSE) %>% 
    tibble::as_tibble() %>% 
    magrittr::set_colnames(c("Clouded", "Frequency")) %>%  
    ggplot2::ggplot() +
    ggplot2::geom_bar(mapping = aes(x = Clouded, y = Frequency), 
                      stat = "identity") + 
    ggplot2::theme(text = element_text(size = 22)) +
    ggplot2::xlab(" ") + 
    ggplot2::ylab(" ")
ggplot2::ggsave(filename = "/home/alber/Documents/data/experiments/prodes_reproduction/papers/deforestation/plot/cloud_histogram.png")   
albhasan/sits.starfm documentation built on Sept. 3, 2020, 4:03 p.m.