Commit c9891886 authored by Heraut Louis's avatar Heraut Louis
Browse files

Layout

parent 3327e8cf
No related merge requests found
Showing with 59 additions and 21 deletions
+59 -21
...@@ -1319,6 +1319,7 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1319,6 +1319,7 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
lat = c() lat = c()
fill = c() fill = c()
shape = c() shape = c()
trend = c()
for (code in Code) { for (code in Code) {
...@@ -1349,11 +1350,11 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1349,11 +1350,11 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
trendMean = df_trend_code_per$trend / dataMean trendMean = df_trend_code_per$trend / dataMean
color_res = get_color(trendMean, color_res = get_color(trendMean,
minTrendMean[idPer, i], minTrendMean[idPer, i],
maxTrendMean[idPer, i], maxTrendMean[idPer, i],
palette_name='perso', palette_name='perso',
reverse=TRUE, reverse=TRUE,
ncolor=ncolor, ncolor=ncolor,
nbTick=nbTick) nbTick=nbTick)
if (df_trend_code_per$p <= p_threshold){ if (df_trend_code_per$p <= p_threshold){
...@@ -1381,6 +1382,7 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1381,6 +1382,7 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
lat = c(lat, lattmp) lat = c(lat, lattmp)
fill = c(fill, filltmp) fill = c(fill, filltmp)
shape = c(shape, shapetmp) shape = c(shape, shapetmp)
trend = c(trend, trendMean)
} }
...@@ -1512,7 +1514,20 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1512,7 +1514,20 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
hjust=0, vjust=0.5, hjust=0, vjust=0.5,
size=3, color='grey40') size=3, color='grey40')
yTrend = (trend - minTrendMean[idPer, i]) /
(maxTrendMean[idPer, i] - minTrendMean[idPer, i]) * valNorm
xTrend = rnorm(length(yTrend), mean=2, sd=0.1)
plot_trend = tibble(xTrend=xTrend, yTrend=yTrend)
pal = pal +
geom_point(data=plot_trend,
aes(x=xTrend, y=yTrend),
shape=21, size=1,
color="grey40", fill="grey10")
pal = pal + pal = pal +
scale_x_continuous(limits=c(-1, 1 + 3), scale_x_continuous(limits=c(-1, 1 + 3),
...@@ -1524,6 +1539,9 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1524,6 +1539,9 @@ map_panel = function (list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
theme(plot.margin=margin(t=0, r=5, b=5, l=0, unit="mm")) theme(plot.margin=margin(t=0, r=5, b=5, l=0, unit="mm"))
Map = list(map, title, pal) Map = list(map, title, pal)
plot = grid.arrange(grobs=Map, layout_matrix= plot = grid.arrange(grobs=Map, layout_matrix=
...@@ -1603,10 +1621,11 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1603,10 +1621,11 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
hyd = void hyd = void
} }
# databin = list_df2plot[[1]]$data[list_df2plot[[1]]$data$code == codeLight,]
# yearLast = format(databin$Date[nrow(databin)], "%Y") # yearLast = format(databin$Date[nrow(databin)], "%Y")
# yearFirst = format(databin$Date[1], "%Y") # yearFirst = format(databin$Date[1], "%Y")
# Nyear = yearLast - yearFirst + 1 # Nyear = as.numeric(yearLast) - as.numeric(yearFirst) + 1
map = map_panel(list_df2plot, map = map_panel(list_df2plot,
df_meta, df_meta,
computer_data_path=computer_data_path, computer_data_path=computer_data_path,
...@@ -1623,7 +1642,12 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1623,7 +1642,12 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
df_meta_code = df_meta[df_meta$code == codeLight,] df_meta_code = df_meta[df_meta$code == codeLight,]
nom = df_meta_code$nom nom = df_meta_code$nom
nom = gsub("-", "-&nbsp;", nom) nom = gsub("-", "-&nbsp;", nom)
duration = as.numeric(format(as.Date(df_meta_code$fin), "%Y")) -
as.numeric(format(as.Date(df_meta_code$debut), "%Y"))
debut = format(as.Date(df_meta_code$debut), "%d/%m/%Y")
fin = format(as.Date(df_meta_code$fin), "%d/%m/%Y")
text1 = paste( text1 = paste(
"<b>", codeLight, '</b> - ', nom, "<b>", codeLight, '</b> - ', nom,
...@@ -1639,14 +1663,17 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1639,14 +1663,17 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
text3 = paste( text3 = paste(
"<b>", "<b>",
"Superficie : ", df_meta_code$surface_km2_BH, " [km<sup>2</sup>] <br>", "Superficie : ", df_meta_code$surface_km2_BH, " [km<sup>2</sup>] <br>",
"X = ", df_meta_code$L93X_m_BH, " [m ; Lambert 93]", "Altitude : ", df_meta_code$altitude_m_BH, " [m]<br>",
"X = ", df_meta_code$L93X_m_BH, " [m ; Lambert 93]<br>",
"Y = ", df_meta_code$L93Y_m_BH, " [m ; Lambert 93]",
"</b>", "</b>",
sep='') sep='')
text4 = paste( text4 = paste(
"<b>", "<b>",
"Altitude : ", df_meta_code$altitude_m_BH, " [m]<br>", "Date de dbut : ", debut, "<br>",
"Y = ", df_meta_code$L93Y_m_BH, " [m ; Lambert 93]", "Date de fin : ", fin, "<br>",
"Nombre d'annes : ", duration, " [ans]",
"</b>", "</b>",
sep='') sep='')
...@@ -1657,7 +1684,7 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1657,7 +1684,7 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
gp=gpar(col="#00A3A8", fontsize=14)) gp=gpar(col="#00A3A8", fontsize=14))
gtext2 = richtext_grob(text2, gtext2 = richtext_grob(text2,
x=0, y=0.55, x=0, y=1,
margin=unit(c(t=0, r=0, b=0, l=5), "mm"), margin=unit(c(t=0, r=0, b=0, l=5), "mm"),
hjust=0, vjust=1, hjust=0, vjust=1,
gp=gpar(col="grey20", fontsize=8)) gp=gpar(col="grey20", fontsize=8))
...@@ -1680,17 +1707,24 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s ...@@ -1680,17 +1707,24 @@ info_panel = function(list_df2plot, df_meta, computer_data_path, fr_shpdir, fr_s
plot.margin=margin(t=0, r=0, b=0, l=0, unit="mm")) plot.margin=margin(t=0, r=0, b=0, l=0, unit="mm"))
P = list(gtext1, gtext2, gtext3, gtext4, hyd, map) P = list(gtext1, gtext2, gtext3, gtext4, hyd, map)
# P = list(void, void, void, void, void, void) # P = list(void, void, void, void, void, void, void)
LM = matrix(c(1, 1, 1, 6,
7, 7, 7, 6,
2, 2, 5, 6,
# 2, 2, 5, 6,
3, 4, 5, 6,
3, 4, 5, 6),
nrow=5,
byrow=TRUE)
heights = rep(1, times=nrow(LM))
heights[2] = 0.1
heights[3] = 0.8
plot = grid.arrange(grobs=P, plot = grid.arrange(grobs=P,
layout_matrix=matrix(c(1, 1, 1, 6, layout_matrix=LM,
2, 2, 5, 6, heights=heights)
2, 2, 5, 6,
3, 4, 5, 6,
3, 4, 5, 6),
nrow=5,
byrow=TRUE))
return(plot) return(plot)
} }
......
...@@ -342,3 +342,4 @@ get_VCN10trend = function (df_data, df_meta, period, p_thresold) { ...@@ -342,3 +342,4 @@ get_VCN10trend = function (df_data, df_meta, period, p_thresold) {
...@@ -285,6 +285,9 @@ extract_meta = function (computer_data_path, filedir, filename, verbose=TRUE) { ...@@ -285,6 +285,9 @@ extract_meta = function (computer_data_path, filedir, filename, verbose=TRUE) {
altitude_m_IN=as.numeric(substr(metatxt[20], 52, 63)), altitude_m_IN=as.numeric(substr(metatxt[20], 52, 63)),
altitude_m_BH=as.numeric(substr(metatxt[20], 38, 50)), altitude_m_BH=as.numeric(substr(metatxt[20], 38, 50)),
debut=substr(metatxt[25], 38, 50),
fin=substr(metatxt[25], 52, 63),
statut=iStatut[trimws(substr(metatxt[26], 38, 50))], statut=iStatut[trimws(substr(metatxt[26], 38, 50))],
finalite=iFinalite[trimws(substr(metatxt[26], 52, 56))], finalite=iFinalite[trimws(substr(metatxt[26], 52, 56))],
......
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