eliocamp / metR

Tools for Easier Analysis of Meteorological Fields
https://eliocamp.github.io/metR/
139 stars 22 forks source link

contour over a map #175

Closed fipoucat closed 9 months ago

fipoucat commented 1 year ago

Hi there,

I want to replicate a map with contours of correlations in a dataframe. Then use a specific color (ex green) to color region with 95% confidence interval using metR. an example attached corr_precip

eliocamp commented 1 year ago

I don't understand what you mean by colouring the 95% interval. If you are saying that you want to shade correlations that are different from zero with 95% confidence you can use geom_contour_fill(aes(z = pval), colour = "green", breaks = c(0, 0.05)) to fill zones with p-values smaller than 0.05 (you can also chose whatever cut-off you like; this assumes that you have a pval column).

fipoucat commented 1 year ago

@eliocamp You comment is correct and reflects what I am trying to do. I have first to create a dataframe with lon lat pr mi where mi is my monsoon index (seaonal) and seasonal (pr), I then have tor compute the correlation (rr). It's this I want to contour on the map and shade areas with 95% confidence interval. the rainfall data is gridded but the mi index is one value per season.