Newer
Older
width = 30
height = 14
dpi = 100
panel = function (df_data, df_info, figdir, filedir, span=Inf) {
# If there is not a dedicated figure directory it creats one
# outdir = file.path(figdir, filedir, paste('span_', as.character(span), '_years', sep=''))
outdir = file.path(figdir, filedir, sep='')
# Get all different stations code
Code = levels(factor(df_info$code))
for (code in Code) {
# Create name for the figure file
outfile = paste('Panel_', code, '.pdf', sep='')
print(paste("Plotting for sation :", code))
df_data_code = df_data[df_data$code==code,]
# Plot
plot =
ggplot(df_data_code, aes(x=Date, y=Qls)) +
geom_line()
# Save the plot
ggsave(path=outdir,
filename=outfile,
plot=plot,
width=width,
height=height,
dpi=dpi,
units='cm')
}