Dades mensuals
# linies de la precipitació mensual
plot <- ggplot(data=df.p, aes(x=mes, y=rainmm_sum)) +
geom_bar(stat="identity", fill="steelblue") +
scale_color_brewer(palette="Paired") +
xlim("01", "02","03","04","05","06","07","08","09","10","11","12") +
ggtitle("Precipitació mensual per cada any") + xlab("Mes") + ylab("Precipitació (mm)") +
facet_grid(any ~ estacio)
plot

# linies de la temperatura mesnual mitjana
plot <- ggplot(data=df.p, aes(x=mes, y=tempc_avg, color = any)) +
geom_line() +
geom_point() +
xlim("01", "02","03","04","05","06","07","08","09","10","11","12") +
ggtitle("Temperatura mitjana mensual") + xlab("Mes") + ylab("Temperatura (ºC)") + labs(color = "Any") +
facet_grid(. ~ estacio)
plot

# amb barres d'error
plot <- ggplot(df.p, aes(x=mes, y=tempc_avg, group=any, color=any)) +
geom_errorbar(aes(ymin=tempc_avg-tempc_sd, ymax=tempc_avg+tempc_sd), width=.1,
position=position_dodge(0.05), size = 1) +
geom_line(size = 1) + geom_point()+
scale_color_brewer(palette="Dark2") +
xlim("01", "02","03","04","05","06","07","08","09","10","11","12") +
ggtitle("Temperatura mitjana mensual") + xlab("Mes") + ylab("Temperatura (ºC)") + labs(color = "Any") +
#theme_classic() +
facet_grid(. ~ estacio)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
plot

Dades diàries
plot <- ggplot(df.d, aes(x=data, y=tempc_avg, group=any, color=any)) +
geom_errorbar(aes(ymin=tempc_avg-tempc_sd, ymax=tempc_avg+tempc_sd), width=.1,
position=position_dodge(0.05), size = 1) +
geom_line(size = 1) + geom_point()+
scale_color_brewer(palette="Dark2") +
ggtitle("Temperatura mitjana diaria") + xlab("Dia") + ylab("Temperatura (ºC)") + labs(color = "Any") +
#theme_classic() +
facet_grid(estacio ~ .)
plot
## Warning: Removed 5 rows containing missing values (`geom_point()`).

ggplotly(plot)
plot <- ggplot(df.d, aes(x=diaany, y=tempc_avg, group=any, color=any)) +
geom_errorbar(aes(ymin=tempc_avg-tempc_sd, ymax=tempc_avg+tempc_sd), width=.1,
position=position_dodge(0.05), size = 1) +
geom_line(size = 1) + geom_point()+
scale_color_brewer(palette="Dark2") +
ggtitle("Temperatura mitjana diaria") + xlab("Dia de l'any") + ylab("Temperatura (ºC)") + labs(color = "Any") +
#theme_classic() +
facet_grid(estacio ~ .)
plot
## Warning: Removed 5 rows containing missing values (`geom_point()`).

plot <- ggplot(data=df.d, aes(x=diaany, y=tempc_avg, color = any)) +
# geom_line() +
geom_point(size = .1) +
geom_smooth(span = 0.3) +
geom_hline( aes(yintercept = (tempc_avg_any), col = any)) + #línia de la mitjana per anys, però no entenc perquè no surt la de 2021
ggtitle("Temperatura mitjana diaria") + xlab("Dia de l'any") + ylab("Temperatura (ºC)") + labs(color = "Any") +
facet_grid(estacio ~ .)
plot
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
## Warning: Removed 5 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 5 rows containing missing values (`geom_point()`).

plot <- ggplot(data=df.t, aes(x=diaany, y=tempc, color = any)) +
# geom_line() +
geom_point(size = .1) +
geom_smooth() +
ggtitle("Temperatura diaria") + xlab("Dia de l'any") + ylab("Temperatura (ºC)") + labs(color = "Any") +
facet_grid(. ~ estacio)
plot
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
## Warning: Removed 4121 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 4121 rows containing missing values (`geom_point()`).
