Commit 0c497219 authored by Heraut Louis's avatar Heraut Louis
Browse files

logo

parent 2e7db5ce
No related merge requests found
Showing with 1770 additions and 7 deletions
+1770 -7
This diff is collapsed.
...@@ -41,6 +41,7 @@ library(ggh4x) ...@@ -41,6 +41,7 @@ library(ggh4x)
library(RColorBrewer) library(RColorBrewer)
library(rgdal) library(rgdal)
library(shadowtext) library(shadowtext)
library(png)
# Sourcing R file # Sourcing R file
...@@ -114,6 +115,11 @@ void = ggplot() + geom_blank(aes(1,1)) + ...@@ -114,6 +115,11 @@ void = ggplot() + geom_blank(aes(1,1)) +
axis.line = element_blank() axis.line = element_blank()
) )
# A plot completly blank with a contour
contour = void +
theme(plot.background=element_rect(fill=NA, color="#EC4899"),
plot.margin=margin(t=0, r=0, b=0, l=0, unit="mm"))
### 2.2. Circle ### 2.2. Circle
# Allow to draw circle in ggplot2 with a radius and a center position # Allow to draw circle in ggplot2 with a radius and a center position
gg_circle = function(r, xc, yc, color="black", fill=NA, ...) { gg_circle = function(r, xc, yc, color="black", fill=NA, ...) {
...@@ -137,8 +143,12 @@ datasheet_layout = function (df_data, df_meta, layout_matrix, ...@@ -137,8 +143,12 @@ datasheet_layout = function (df_data, df_meta, layout_matrix,
missRect=FALSE, time_header=NULL, missRect=FALSE, time_header=NULL,
info_header=TRUE, foot_note=FALSE, info_header=TRUE, foot_note=FALSE,
info_ratio=1, time_ratio=2, info_ratio=1, time_ratio=2,
var_ratio=3, foot_ratio=0.5, var_ratio=3, foot_height=0.5,
df_shapefile=NULL) { df_shapefile=NULL,
resource_path=NULL,
AEAGlogo_file=NULL,
INRAElogo_file=NULL,
FRlogo_file=NULL) {
# Name of the document # Name of the document
outfile = "Panels" outfile = "Panels"
...@@ -235,7 +245,7 @@ datasheet_layout = function (df_data, df_meta, layout_matrix, ...@@ -235,7 +245,7 @@ datasheet_layout = function (df_data, df_meta, layout_matrix,
# If datasheets needs to be plot # If datasheets needs to be plot
if ('datasheet' %in% toplot) { if ('datasheet' %in% toplot) {
datasheet_panel(list_df2plot, df_meta, trend_period, info_header=info_header, time_header=time_header, foot_note=foot_note, layout_matrix=layout_matrix, info_ratio=info_ratio, time_ratio=time_ratio, var_ratio=var_ratio, foot_ratio=foot_ratio, outdirTmp=outdirTmp) datasheet_panel(list_df2plot, df_meta, trend_period, info_header=info_header, time_header=time_header, foot_note=foot_note, layout_matrix=layout_matrix, info_ratio=info_ratio, time_ratio=time_ratio, var_ratio=var_ratio, foot_height=foot_height, resource_path=resource_path, AEAGlogo_file=AEAGlogo_file, INRAElogo_file=INRAElogo_file, FRlogo_file=FRlogo_file, outdirTmp=outdirTmp)
} }
......
# \\\
# Copyright 2021-2022 Louis Héraut*1
#
# *1 INRAE, France
# louis.heraut@inrae.fr
#
# This file is part of ash R toolbox.
#
# ash R toolbox is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# ash R toolbox is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ash R toolbox. If not, see <https://www.gnu.org/licenses/>.
# ///
#
#
# results_manager.R
#
# Manages the writing and reading of results data of the trend analysis.
write_listofdf = function (Ldf, resdir, filedir) {
outdir = file.path(resdir, filedir)
if (!(file.exists(outdir))) {
dir.create(outdir)
}
Lname = names(Ldf)
Nname = length(Lname)
for (i in 1:Nname) {
outfile = paste(Lname[i], '.txt', sep='')
write.table(Ldf[[i]],
file=file.path(outdir, outfile),
sep=";",
quote=TRUE,
row.names=FALSE)
}
}
# write_listofdf(res_tINItrend, resdir, 'res_tINItrend')
read_listofdf = function (resdir, filedir) {
outdir = file.path(resdir, filedir)
files = list.files(outdir)
Nfile = length(files)
Ldf = list()
for (i in 1:Nfile) {
name = splitext(files[i])$name
df = as_tibble(read.table(file=file.path(outdir, files[i]),
header=TRUE,
sep=";",
quote='"'))
for (j in 1:ncol(df)) {
if (is.factor(df[[j]])) {
d = try(as.Date(df[[1, j]], format="%Y-%m-%d"))
if("try-error" %in% class(d) || is.na(d)) {
df[j] = as.character(df[[j]])
} else {
df[j] = as.Date(df[[j]])
}
}
}
# OkFact = sapply(df, is.factor)
# df[OkFact] = lapply(df[OkFact], as.character)
Ldf = append(Ldf, list(df))
names(Ldf)[length(Ldf)] = name
}
return (Ldf)
}
# res_tINItrend = read_listofdf(resdir, 'res_tINItrend')
splitext = function(file) {
ex = strsplit(basename(file), split="\\.")[[1]]
res = list(name=ex[1], extension=ex[2])
return (res)
}
resources/Logo-INRAE_Transparent.png

8.43 KB

resources/Republique_Francaise_RVB.png

121 KB

resources/agence-de-leau-adour-garonne_logo.png

159 KB

...@@ -63,7 +63,7 @@ filename = ...@@ -63,7 +63,7 @@ filename =
# "P0885010_HYDRO_QJM.txt", # "P0885010_HYDRO_QJM.txt",
# "O5055010_HYDRO_QJM.txt", # "O5055010_HYDRO_QJM.txt",
# "O0384010_HYDRO_QJM.txt", # "O0384010_HYDRO_QJM.txt",
# "S4214010_HYDRO_QJM.txt" # "S4214010_HYDRO_QJM.txt",
"Q7002910_HYDRO_QJM.txt" "Q7002910_HYDRO_QJM.txt"
# "O3035210_HYDRO_QJM.txt", # "O3035210_HYDRO_QJM.txt",
# "O0554010_HYDRO_QJM.txt", # "O0554010_HYDRO_QJM.txt",
...@@ -154,6 +154,18 @@ if (!(file.exists(figdir))) { ...@@ -154,6 +154,18 @@ if (!(file.exists(figdir))) {
} }
print(paste('figdir :', figdir)) print(paste('figdir :', figdir))
# Resource directory
resource_path = file.path(computer_work_path, 'resource')
if (!(file.exists(resource_path))) {
dir.create(resource_path)
}
print(paste('resource_path :', resource_path))
# Logo filename
AEAGlogo_file = 'agence-de-leau-adour-garonne_logo.png'
INRAElogo_file = 'Logo-INRAE_Transparent.png'
FRlogo_file = 'Republique_Francaise_RVB.png'
## 2. SELECTION OF STATION ## 2. SELECTION OF STATION
# Initialization of null data frame if there is no data selected # Initialization of null data frame if there is no data selected
...@@ -335,8 +347,11 @@ datasheet_layout(toplot=c( ...@@ -335,8 +347,11 @@ datasheet_layout(toplot=c(
info_ratio=2, info_ratio=2,
time_ratio=2, time_ratio=2,
var_ratio=3, var_ratio=3,
foot_ratio=0.5, foot_height=1,
df_shapefile=df_shapefile, df_shapefile=df_shapefile,
figdir=figdir, figdir=figdir,
filename_opt='') filename_opt='',
resource_path=resource_path,
AEAGlogo_file=AEAGlogo_file,
INRAElogo_file=INRAElogo_file,
FRlogo_file=FRlogo_file)
...@@ -15,6 +15,7 @@ install.packages('extrafont') ...@@ -15,6 +15,7 @@ install.packages('extrafont')
install.packages("RColorBrewer") install.packages("RColorBrewer")
install.packages('trend') install.packages('trend')
install.packages("shadowtext") install.packages("shadowtext")
install.packages("png")
# linux # linux
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment