Last active
September 14, 2022 22:51
-
-
Save juanchiem/d0d39f915ad0303f250e6da3256cc74d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library("tidyverse") | |
| library("geometry") | |
| data.frame(trap_degree = c(0,0,90,90), | |
| distance_m = c(100, 200, 100, 200))%>% | |
| mutate(data.frame(pol2cart(theta = trap_degree, r = distance_m))) %>% | |
| ggplot()+ | |
| aes(x=y, y=x)+ | |
| geom_point() + | |
| geom_text(aes(label=paste0(trap_degree,",", distance_m), vjust=1))+ | |
| geom_hline(yintercept = 0)+ | |
| geom_vline(xintercept = 0) | |
| # 2nd question: | |
| # should the angle of attack of wind to the spore traps be min 0° up to 180° max?? | |
| expand_grid(trap_degrees = c(0, 90, 180, 270, 359), | |
| wind_degrees = c(0, 45, 90, 135, 180, 225, 270, 315, 359))%>% | |
| mutate(degree_dif = (wind_degrees - trap_degrees)) %>% | |
| mutate(degree_dif2=case_when((abs(degree_dif)<=180)~abs(degree_dif), | |
| (abs(degree_dif)>180)~360-abs(degree_dif))) %>% | |
| ggplot()+ | |
| aes(degree_dif, degree_dif2)+ | |
| geom_point(alpha=.5)+ | |
| ggrepel::geom_text_repel( | |
| aes(degree_dif, degree_dif2, label=paste0(trap_degrees,",", wind_degrees), vjust=1))+ | |
| lims(x=c(-360,360), y=c(0,180)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#2
