[R-sig-Geo] Need to plot all 5 spatial maps together in a single window
J. Marius RAKOTONDRAMANGA
je@n@m@r|u@@g @end|ng |rom gm@||@com
Thu Jun 9 09:48:54 CEST 2022
Hi Ranjeet,
Have a look to this function cowplot::plot_grid(), from
https://wilkelab.org/cowplot/articles/plot_grid.html
It has mainy features and permit you to save also the combined plots :
here https://search.r-project.org/CRAN/refmans/cowplot/html/save_plot.html
or https://wilkelab.org/cowplot/reference/ggsave2.html
Regards,
Marius,
---------
J. Marius RAKOTONDRAMANGA, MSc
PhD Student in Biostatistics/Biomathematics
ED 393 Pierre Louis de Santé Publique : Epidémiologie et Sciences de
l'Information Biomédicale
Sorbonne Université (ex. UPMC)
Le jeu. 9 juin 2022 à 08:29, Ranjeet Kumar Jha <ranjeetjhaiitkgp using gmail.com>
a écrit :
> Hi,
>
> I like to plot all my 5 spatial maps of drought indices in a single window
> using the sf plot function in R. I am able to plot all maps separately but
> unable to plot altogether. All indexes are showing drought indices.
>
> I really appreciate your help!
>
> Here is the code:
>
> #merging using merge function
> merge_drought_indices <- merge(shp_dist, drought_indices)
> view(merge_drought_indices)
> #plot in a single window
> library(sf)
> par(mfrow=c(2,2))
> plot(merge_drought_indices["r_count_lt_p05_harvest_end"],
> pal = colorRampPalette(c("red", "white", "blue","green")),
> main = "End harvest index variation in India during drought year 2000",
> key.pos = 4, axes = TRUE, key.width = lcm(1.3), key.length = 1.0)
>
> plot(merge_drought_indices["r_count_lt_p05_harvest"],
> pal = colorRampPalette(c("red", "white", "blue","green")),
> main = "Harvest variation index in India during drought year 2000",
> key.pos = 4, axes = TRUE, key.width = lcm(1.3), key.length = 1.0)
>
> plot(merge_drought_indices["r_count_lt_p05_main"],
> pal = colorRampPalette(c("red", "white", "blue","green")),
> main = "Main growth stage index variation in India during drought year
> 2000",
> key.pos = 4, axes = TRUE, key.width = lcm(1.3), key.length = 1.0)
>
> plot(merge_drought_indices["r_count_lt_p05_plant.start"],
> pal = colorRampPalette(c("red", "white", "blue","green")),
> main = "Plant start index variation in India during drought year 2000",
> key.pos = 4, axes = TRUE, key.width = lcm(1.3), key.length = 1.0)
>
> plot(merge_drought_indices["r_count_lt_p05_plant"],
> pal = colorRampPalette(c("red", "white", "blue","green")),
> main = "main plant stage index variation in India during drought year
> 2000",
> key.pos = 4, axes = TRUE, key.width = lcm(1.3), key.length = 1.0)
>
>
> Regards and Thanks,
>
> Ranjeet
>
>
> --
>
>
>
> *"Simple Heart, Humble Attitude and Surrender to Supreme Being make our
> lives beautiful!"*
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list