0

I am trying to plot a total delay (in mins) vs aircraft name graph faceted by 12 months. The data set (p) that I am using has some variables like total delay, weather delay (in mins),carrier delay (in mins), aircraft name. (total delay = sum of 2 variables weather delay+carrier delay) I want fill as 2 variables (weather delay, carrier delay etc) I am able to plot a total delay vs aircraft but do not know how to fill in each bar with values of the 2 variables weather_delay and carrier delay.

ggplot(subset(p, airport %in% c( "IAD")) + 
       aes(x= aircraft_name, y = total_delay, color = airport) + 
       geom_histogram(stat ="identity",binwidth=1) + 
       facet_grid(~month,scales='free')

The problem I am facing is the dataset contains variables like weather delay, carrier delay, security delay which sum up to the total delay. I want to show every bar of total delay as a component of the 3 delays. The fill part should consist of the 3 variables delays.

tonytonov
  • 25,060
  • 16
  • 82
  • 98
  • 3
    Could you please show us the code you have so far? – Rich Scriven Feb 24 '14 at 16:25
  • Welcome to SO. Start here: http://stackoverflow.com/q/5963269/134830 – Richie Cotton Feb 24 '14 at 16:48
  • ggplot(subset(p, airport %in% c( "IAD"))+aes(x= aircraft_name, y = total_delay, color = airport)+ geom_histogram(stat ="identity",binwidth=1)+facet_grid(~month,scales='free') – user3314790 Feb 24 '14 at 16:50
  • The problem I am facing is the dataset contains variables like weather delay, carrier delay, security delay which sum up to the total delay. I want to show every bar of total delay as a component of the 3 delays. The fill part should consist of the 3 variables delays – user3314790 Feb 24 '14 at 16:54
  • 1
    @user3314790 you should be putting the content of these comments into your question. – Matthew Plourde Feb 24 '14 at 16:55
  • 1
    Please include the data sample as well: your example is still not reproducible. – tonytonov Feb 25 '14 at 05:40

0 Answers0