Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Malaria Spleen RBC Loss
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
Rob Moss
Malaria Spleen RBC Loss
Commits
0b888640
Commit
0b888640
authored
1 year ago
by
Rob Moss
Browse files
Options
Downloads
Patches
Plain Diff
Plot the iRBC % ratio for each scenario
parent
fbcc29ab
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plot-scenarios.R
+13
-7
13 additions, 7 deletions
plot-scenarios.R
with
13 additions
and
7 deletions
plot-scenarios.R
+
13
−
7
View file @
0b888640
...
...
@@ -6,6 +6,7 @@ script_name <- "plot-scenarios.R"
prepare_data
<-
function
(
input_file
)
{
read.csv
(
input_file
,
header
=
TRUE
)
|>
infection_flows_and_loss
()
|>
calculate_irbc_ratio
()
|>
mutate
(
sim_no
=
factor
(
scenario
))
|>
pivot_longer
(
!
c
(
"time"
,
"sim_no"
))
|>
mutate
(
days
=
time
/
24
)
...
...
@@ -57,8 +58,13 @@ make_plots <- function(df) {
xlab
(
"Time (days)"
)
+
scale_y_log10
()
+
facet_wrap
(
~
name
),
ratio
=
ggplot
(
df
|>
filter
(
name
==
c
(
"iRBC_Ratio"
)),
aes
(
days
,
value
,
colour
=
sim_no
))
+
geom_line
()
+
xlab
(
"Time (days)"
)
+
scale_y_log10
(),
macro
=
ggplot
(
df
|>
filter
(
name
==
"M_t"
),
aes
(
days
,
value
,
colour
=
sim_no
))
+
aes
(
days
,
value
,
colour
=
sim_no
))
+
geom_line
()
+
xlab
(
"Time (days)"
)
+
ylab
(
expression
(
M
(
t
)))
+
...
...
@@ -77,12 +83,6 @@ make_plots <- function(df) {
main
<-
function
(
args
)
{
suppressPackageStartupMessages
(
library
(
dplyr
))
suppressPackageStartupMessages
(
library
(
tidyr
))
suppressPackageStartupMessages
(
library
(
ggplot2
))
devtools
::
load_all
(
"."
,
export_all
=
FALSE
)
if
(
length
(
args
)
!=
1
)
{
cat
(
"\n"
)
cat
(
"USAGE:"
,
script_name
,
"results.csv\n"
)
...
...
@@ -96,6 +96,12 @@ main <- function(args) {
return
(
2
)
}
suppressPackageStartupMessages
(
library
(
dplyr
))
suppressPackageStartupMessages
(
library
(
tidyr
))
suppressPackageStartupMessages
(
library
(
ggplot2
))
devtools
::
load_all
(
"."
,
export_all
=
FALSE
)
plot_dir
<-
dirname
(
input_file
)
plot_prefix
<-
tools
::
file_path_sans_ext
(
basename
(
input_file
))
df
<-
prepare_data
(
input_file
)
...
...
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