Ci-dessous mon jeu de donnees:
Code : Tout sélectionner
complet_w <- structure(list(SOUNAME = c("WATERFORD (TYCOR)", "WATERFORD (TYCOR)",
"WATERFORD (TYCOR)", "WATERFORD (TYCOR)", "WATERFORD (TYCOR)",
"WATERFORD (TYCOR)", "WATERFORD (TYCOR)", "WATERFORD (TYCOR)",
"WATERFORD (TYCOR)", "WATERFORD (TYCOR)", "WATERFORD (TYCOR)",
"WATERFORD (TYCOR)"), year_month = c("2014-04", "2014-04", "2014-04",
"2014-04", "2014-05", "2014-05", "2014-05", "2014-05", "2014-06",
"2014-06", "2014-06", "2014-06"), pre_type = c("NONE", "HEAVY",
"LIGHT", "MEDIUM", "NONE", "HEAVY", "LIGHT", "MEDIUM", "NONE",
"HEAVY", "LIGHT", "MEDIUM"), pre_value = c(14, 3, 7, 6, 15, 3,
10, 3, 17, 2, 9, 2), tem_type = c("V_COLD", "COLD", "HOT", "MEDIUM",
"V_COLD", "COLD", "HOT", "MEDIUM", "V_COLD", "COLD", "HOT", "MEDIUM"
), tem_value = c(0, 30, 0, 0, 0, 31, 0, 0, 0, 17, 13, 0), nb_species = c("NA",
"8", "NA", "NA", "NA", "17", "NA", "NA", "NA", "NA", "NA", "NA"
)), .Names = c("SOUNAME", "year_month", "pre_type", "pre_value",
"tem_type", "tem_value", "nb_species"), row.names = c(NA, -12L
), class = c("tbl_df", "tbl", "data.frame"))
Ci-dessous mon code du graphique:
Code : Tout sélectionner
ggplot(data = complet_w, aes(x = complet_w$year_month,
y = complet_w$pre_value,
fill = complet_w$pre_type, width=0.5), stat = "identity") +
geom_bar(stat = "identity") +
xlab("date") + ylab ("Number of days of precipitation") +
ggtitle("Precipitation per month") + labs(fill = "Frequency") +
geom_bar(data=complet_w,aes(x=complet_w$year_month,
y=complet_w$tem_value,
fill=complet_w$tem_type, width=0.1), stat = "identity", position = position_nudge(x=0.4)) +
xlab("date") + ylab("Number of days of temperature") +
ggtitle("Temperature per month") + labs(fill = "Frequency")
Je n'arrive pas a afficher l'image depuis mon ordinateur pour vous montrer le résultat... c'est assez rapide à executer avec le code ci-dessus!
Merci d'avance pour votre aide,
Elodie