Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
BC MAC review dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jorge Saturno
BC MAC review dashboard
Commits
f64e7f61
Commit
f64e7f61
authored
7 months ago
by
Jorge Saturno
Browse files
Options
Downloads
Patches
Plain Diff
Add MAC vs. wavelength plot
parent
99a0b835
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app.R
+78
-6
78 additions, 6 deletions
app.R
with
78 additions
and
6 deletions
app.R
+
78
−
6
View file @
f64e7f61
...
...
@@ -12,7 +12,6 @@ library(stringr)
library
(
reshape2
)
library
(
scales
)
library
(
tidyverse
)
# library(hrbrthemes)
library
(
DT
)
# Define UI for application
...
...
@@ -34,7 +33,7 @@ ui <- page_sidebar(
navset_card_underline
(
# title = "Title",
nav_panel
(
"List of studies"
,
girafeOutput
(
"StudyPlot"
)),
nav_panel
(
"MAC vs. λ"
,
plot
Output
(
"
bill_depth
"
)),
nav_panel
(
"MAC vs. λ"
,
girafe
Output
(
"
LambdaPlot
"
)),
nav_panel
(
"Table"
,
DT
::
dataTableOutput
(
'MACtable'
)),
nav_panel
(
"About"
,
uiOutput
(
"README"
))
)
...
...
@@ -119,7 +118,7 @@ server <- function(input, output) {
)
)
# Plot MAC550 as list of studies
output
$
StudyPlot
<-
renderGirafe
({
# Plot MAC 550 using facet for aerosol type
MAC_MAC550
<-
ggplot
(
MAC_data
,
aes
(
x
=
Reference_study
,
y
=
MAC_m2g_550
))
...
...
@@ -139,10 +138,8 @@ server <- function(input, output) {
legend.text
=
element_text
(
size
=
12
),
legend.title
=
element_blank
()
)
+
# labs(colour = "Mass measurement") +
xlab
(
"Study"
)
+
ylab
(
expression
(
paste
(
italic
(
E
)[
abs
],
" • "
,
MAC
[
550
],
" [m²/g]"
)))
+
# scale_color_nejm() +
scale_color_manual
(
values
=
c
(
"#0072B5"
,
"#7cb518"
,
"#ffb703"
,
"#e63946"
))
+
coord_flip
()
+
scale_x_discrete
(
limits
=
rev
)
+
...
...
@@ -174,7 +171,7 @@ server <- function(input, output) {
),
data_id
=
case_when
(
input
$
plot_category
==
"Aerosol_type"
~
Aerosol_type_red
,
input
$
plot_category
==
"Abs_meas"
~
Abs_ref_red
,
#
input$plot_category == "Abs_meas" ~ Abs_ref_red,
input
$
plot_category
==
"Mass_meas"
~
Mass_ref_red
),
tooltip
=
paste
(
Reference_study
,
"\n"
,
round
(
MAC_m2g_550
,
digits
=
2
),
" m²/g"
)),
...
...
@@ -191,6 +188,81 @@ server <- function(input, output) {
))
})
# Plot MAC as function of wavelength
output
$
LambdaPlot
<-
renderGirafe
({
# Plot MAC 550 using facet for aerosol type
MAC_lambda
<-
ggplot
(
MAC_data
,
aes
(
x
=
Wavelength_nm
,
y
=
MAC_m2g
))
MAC_lambda.gg
<-
MAC_lambda
+
# theme_ipsum(base_family = "IBM Plex Sans") +
theme_minimal
()
+
theme
(
axis.text.y
=
element_text
(
size
=
10
),
axis.text.x
=
element_text
(
size
=
12
),
axis.title.x
=
element_text
(
size
=
16
),
axis.title.y
=
element_text
(
size
=
16
),
# panel.grid.major.y = element_blank(),
# panel.grid.minor.y = element_blank(),
strip.text.y
=
element_text
(
angle
=
0
,
size
=
16
),
strip.background
=
element_rect
(
colour
=
"#FFFFFF"
,
fill
=
"#f7f7f9"
),
legend.background
=
element_rect
(
fill
=
"#f7f7f9"
,
colour
=
"#FFFFFF"
),
legend.text
=
element_text
(
size
=
12
),
legend.title
=
element_blank
()
)
+
xlab
(
"Wavelength [nm]"
)
+
ylab
(
expression
(
paste
(
italic
(
E
)[
abs
],
" • "
,
MAC
[
λ
],
" [m²/g]"
)))
+
# scale_x_log10(guide = "axis_logticks", breaks = c(100, 200, 300, 400, 500, 600, 700, 800, 900, 1000), limits = c(200, 1000)) +
scale_x_continuous
(
breaks
=
seq
(
100
,
1000
,
100
),
limits
=
c
(
300
,
1000
))
+
coord_trans
(
x
=
"log10"
)
+
scale_color_manual
(
values
=
c
(
"#0072B5"
,
"#7cb518"
,
"#ffb703"
,
"#e63946"
))
+
# coord_flip() +
# scale_x_discrete(limits=rev) +
# geom_rect(aes(ymin=7, ymax=9, xmin=0, xmax=Inf), fill = "#EEEEEE") +
# geom_hline(yintercept = 8, linetype = 2, linewidth = 1) +
# geom_linerange_interactive(aes(ymin = MAC_m2g_550 - MAC_sd_550,
# ymax =MAC_m2g_550 + MAC_sd_550,
# colour = case_when(
# input$plot_category == "Aerosol_type" ~ Aerosol_type_red,
# input$plot_category == "Abs_meas" ~ Abs_ref_red,
# input$plot_category == "Mass_meas" ~ Mass_ref_red
# ),
# data_id = case_when(
# input$plot_category == "Aerosol_type" ~ Aerosol_type_red,
# input$plot_category == "Abs_meas" ~ Abs_ref_red,
# input$plot_category == "Mass_meas" ~ Mass_ref_red
# )),
# linewidth=4, alpha = 0.15) +
geom_text
(
family
=
"Arial"
,
size
=
10
,
label
=
"\u2727"
,
colour
=
"#FFFFFF"
,
show.legend
=
FALSE
,
position
=
position_nudge
(
x
=
0.1
))
+
# Simulation of stroke line
geom_text
(
family
=
"Arial"
,
size
=
7
,
label
=
"\u2727"
,
colour
=
"#777777"
,
show.legend
=
FALSE
,
position
=
position_nudge
(
x
=
0.1
))
+
# Simulation of stroke line
geom_text_interactive
(
aes
(
colour
=
case_when
(
input
$
plot_category
==
"Aerosol_type"
~
Aerosol_type_red
,
input
$
plot_category
==
"Abs_meas"
~
Abs_ref_red
,
input
$
plot_category
==
"Mass_meas"
~
Mass_ref_red
),
data_id
=
case_when
(
input
$
plot_category
==
"Aerosol_type"
~
Aerosol_type_red
,
# input$plot_category == "Abs_meas" ~ Abs_ref_red,
input
$
plot_category
==
"Mass_meas"
~
Mass_ref_red
),
tooltip
=
paste
(
Reference_study
,
"\n"
,
round
(
MAC_m2g
,
digits
=
2
),
" m²/g"
)),
family
=
"Arial"
,
size
=
7
,
label
=
"\u2726"
,
alpha
=
0.7
,
show.legend
=
TRUE
,
position
=
position_nudge
(
x
=
0.1
))
# Fill character in front
girafe
(
ggobj
=
MAC_lambda.gg
,
width_svg
=
14
,
height_svg
=
10
,
options
=
list
(
opts_hover
(
css
=
"fill:grey80;"
),
opts_hover_inv
(
css
=
"opacity:0.1;"
),
opts_selection
(
type
=
"single"
,
only_shiny
=
FALSE
)
))
})
output
$
MACtable
<-
DT
::
renderDataTable
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment