กราฟใน purrr

Foundations of Functional Programming with purrr

Auriel Fournier

Instructor

ทบทวน ggplot()

  • ggplot() ต้องการ data frame เป็น input
  • เริ่มต้นด้วย ggplot() เสมอ
  • เพิ่ม layer โดยใช้ +
  • geom_*() กำหนดประเภทของกราฟ
ggplot(data = dataframe, 
       aes(x = columnA,
       y = columnB))+
  geom_point()

Scatter plot แสดงน้ำหนักของนกเทียบกับความยาวปีก

Foundations of Functional Programming with purrr

การสร้างกราฟกับ purrr

birddf <- bird_measurements %>% 
 map_df(~ data_frame(
            wing_length = .x[["wing length"]],
            weight = .x[["weight"]])) %>%
    ggplot(aes(x = weight,
            y = wing_length))+
    geom_point()

Scatter plot แสดงน้ำหนักของนกเทียบกับความยาวปีก

Foundations of Functional Programming with purrr

มาฝึกกันเถอะ!

Foundations of Functional Programming with purrr

Preparing Video For Download...