Advertisement
Rafel99

Untitled

Jul 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.09 KB | None | 0 0
  1. # C. Wybierz jeden konkretny dzień i lotnisko, a następnie dla tego konkretnego dnia i
  2. # lotniska zrób wykres zmiany ciśnienia w ciągu kolejnych godzin.
  3. #D. to samo co w C. plus rozkład prędkości wiatru
  4. require("dplyr")
  5.  
  6. dane <- weather %>% filter(origin =="JFK",month==7,day==16) %>%
  7.   group_by(origin,month,day,hour,pressure,wind_speed) %>%
  8.   select(origin,month,day,hour,pressure,wind_speed)
  9.  
  10. #Odpowiedź na C.
  11.   ggplot(dane,aes(x=hour,y=pressure,fill=wind_speed))+coord_cartesian(ylim=c(1015,1025))+
  12.   geom_bar(stat = 'identity',fill="#56B4E9",colour="black",position = 'dodge')+
  13.   ggtitle("Rozkład godzinowy ciśnienia na lotnisku JFK w dniu 16.07.2013")
  14.  
  15. #Odpowiedź na D.
  16.  
  17.  ggplot()+
  18.     geom_bar(mapping = aes(x = dane$hour, y = dane$pressure*17/1022.6), stat = "identity") +
  19.     geom_point(mapping = aes(x = dane$hour, y = dane$wind_speed)) +
  20.     geom_line(mapping = aes(x = dane$hour, y = dane$wind_speed)) +
  21.     scale_y_continuous(name = expression("Prędkość wiatru [m/s]"),sec.axis = sec_axis(~ . * 1022.6 / 17 , name = "Ciśnienie w hPa"), limits = c(0, 17))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement