[R] need to plot multiple spatial maps side-by-side in a single window using sf plot function in R

Ranjeet Kumar Jha r@njeetjh@||tkgp @end|ng |rom gm@||@com
Sat May 14 16:13:25 CEST 2022


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(sp)
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]]



More information about the R-help mailing list