Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write basic data viz plot for each L1 data file #61

Merged
merged 1 commit into from
Dec 3, 2023
Merged

Write basic data viz plot for each L1 data file #61

merged 1 commit into from
Dec 3, 2023

Conversation

bpbond
Copy link
Member

@bpbond bpbond commented Dec 3, 2023

No description provided.

@bpbond bpbond changed the title Have L1 write a basic data viz plot for each data file Write basic data viz plot for each L1 data file Dec 3, 2023
@bpbond bpbond merged commit f95726c into main Dec 3, 2023
1 check passed
@bpbond bpbond deleted the plots branch December 3, 2023 01:38
@stephpenn1
Copy link
Member

Hello, I know this is already merged, but I wanted to share my code that inspired the error plots. Once main difference is that I colored by flag, which I find to be useful. I will share the code below if helpful,

# Script to test out L1_beta data from Portage
# COMPASS-FME | November 2023
# Stephanie Pennington | [email protected]

# library load
pacman::p_load(cowsay, dplyr, googledrive, tidyr, purrr, readr, ggplot2)
say("Welcome to my script!", by = "random")

# data load
l1_beta_folder <- "https://drive.google.com/drive/u/1/folders/1J-tC1Wt3OqO-KXHV_PaiYj8URZCB57xO"

drive_ls(l1_beta_folder, recursive = TRUE) %>% 
  filter(grepl(c(".csv"), name)) -> l1_beta_files

map(l1_beta_files$id, drive_download, overwrite = TRUE)

filePaths <- l1_beta_files$name

lapply(filePaths, read_csv) %>% bind_rows -> l1_beta

file.remove(c(filePaths))  

# function to plot all research_names

beta_plots <- function(x){
  
  l1_beta %>% 
    filter(research_name == x) %>% 
    ggplot(aes(x = TIMESTAMP, y = value, group = design_link, color = as.factor(OOB))) +
    geom_point() + facet_wrap(~design_link, scales = "free_y") + theme_minimal() + 
    scale_color_manual(values=c("0" = "#999999", "1" = "red")) + 
    labs(color = "OOB", title = x) -> p
  
  ggsave(filename = paste0(x, "_beta_plot.jpg"), 
         plot = p,
         path = "Desktop")
} 

research_names <- unique(l1_beta$research_name)
lapply(research_names, beta_plots)

@bpbond bpbond mentioned this pull request Dec 7, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants