alathrop
12/5/2017 - 8:16 PM

ggplot multiple scaled line

scale multiple measures in one plot


# from KTI SOW 1
# by Andy L

# common plot components
theme_set(theme_bw())
my_facet <- facet_wrap(c("heatNumber"), scales = "free")

###########################

p_avgNSmf <- strand2_bg %>%  
  filter(
    heatNumber %in% c(
      "20505530",
      "20506890",
      "20505540",
      "20506260",
      "20505570",
      "20506270"
    )
  ) %>% 
  ggplot() +
  
  geom_line(aes(y = as.vector(scale(cc_avgNSmf)), x = datetime), 
            color = "lightgrey") +

  geom_line(aes(y = as.vector(scale(cc_loess_avgNSmf)), x = datetime),
            color =  "coral") +

  geom_line(aes(y = as.vector(scale(cc_loessdiff_avgNSmf)), x = datetime), 
            color =  "darkblue") +
  
  geom_hline(yintercept = 0) +

  my_facet +
  
  labs(title = "Average Negative Strip Mold Friction per Effective Area of Mold",
       subtitle = "with loess smoothing and slope")