Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stressaddition
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oekotox
stressaddition
Commits
0f474df3
Commit
0f474df3
authored
5 years ago
by
Sebastian Henz
Browse files
Options
Downloads
Patches
Plain Diff
Resolve TODOs and FIXMEs in plotting functions,
closes
#20
parent
162d8533
No related branches found
No related tags found
1 merge request
!3
V2.0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
NEWS.md
+1
-0
1 addition, 0 deletions
NEWS.md
R/plot_effect.R
+34
-37
34 additions, 37 deletions
R/plot_effect.R
R/plot_system_stress.R
+12
-13
12 additions, 13 deletions
R/plot_system_stress.R
with
47 additions
and
50 deletions
NEWS.md
+
1
−
0
View file @
0f474df3
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
*
New function
`predict_ecxsys()`
replaces
`fn()`
from the
`ecxsys`
output.
*
New function
`predict_ecxsys()`
replaces
`fn()`
from the
`ecxsys`
output.
*
Renamed the arguments in
`ec()`
.
*
Renamed the arguments in
`ec()`
.
*
Made
`ec()`
more flexible. It now also accepts a data.frame with a concentration column and a column of response values.
*
Made
`ec()`
more flexible. It now also accepts a data.frame with a concentration column and a column of response values.
*
Mention LL5 curves in legend of
`plot_effect()`
.
*
Improved the internal structure of the package.
*
Improved the internal structure of the package.
*
Improved the tests.
*
Improved the tests.
*
Improved documentation.
*
Improved documentation.
...
...
This diff is collapsed.
Click to expand it.
R/plot_effect.R
+
34
−
37
View file @
0f474df3
...
@@ -12,7 +12,7 @@ plot_effect <- function(model,
...
@@ -12,7 +12,7 @@ plot_effect <- function(model,
)
)
curves
<-
temp
$
curves
curves
<-
temp
$
curves
log_ticks
<-
get_log_ticks
(
curves
$
concentration
)
log_ticks
<-
get_log_ticks
(
curves
$
concentration
)
model
$
arg
s
$
concentration
[
1
]
<-
curve
s
$
concentration
[
1
]
concentration
<-
c
(
curve
s
$
concentration
[
1
]
,
model
$
arg
s
$
concentration
[
-
1
]
)
plot
(
plot
(
NA
,
NA
,
...
@@ -26,18 +26,19 @@ plot_effect <- function(model,
...
@@ -26,18 +26,19 @@ plot_effect <- function(model,
bty
=
"L"
,
bty
=
"L"
,
las
=
1
las
=
1
)
)
if
(
show_simple_model
)
{
if
(
show_simple_model
)
{
lines
(
lines
(
curves
$
concentration
,
curves
$
concentration
,
curves
$
effect_tox_simple
,
curves
$
effect_tox_simple
,
col
=
rgb
(
112
,
112
,
207
,
maxColorValue
=
255
)
,
col
=
"darkblue"
,
lty
=
4
lty
=
4
)
)
if
(
model
$
with_env
)
{
if
(
model
$
with_env
)
{
lines
(
lines
(
curves
$
concentration
,
curves
$
concentration
,
curves
$
effect_tox_env_simple
,
curves
$
effect_tox_env_simple
,
col
=
rgb
(
207
,
112
,
112
,
maxColorValue
=
255
)
,
col
=
"darkred"
,
lty
=
4
lty
=
4
)
)
}
}
...
@@ -48,63 +49,59 @@ plot_effect <- function(model,
...
@@ -48,63 +49,59 @@ plot_effect <- function(model,
curves
$
effect_tox_sys
,
curves
$
effect_tox_sys
,
col
=
"blue"
col
=
"blue"
)
)
if
(
model
$
with_env
)
{
lines
(
curves
$
concentration
,
curves
$
effect_tox_env_sys
,
col
=
"red"
)
}
lines
(
lines
(
curves
$
concentration
,
curves
$
concentration
,
curves
$
effect_tox
,
curves
$
effect_tox
,
col
=
"deepskyblue"
,
col
=
"deepskyblue"
,
lty
=
2
lty
=
2
)
)
points
(
concentration
,
model
$
args
$
effect_tox_observed
,
pch
=
16
,
col
=
"blue"
)
if
(
model
$
with_env
)
{
if
(
model
$
with_env
)
{
lines
(
curves
$
concentration
,
curves
$
effect_tox_env_sys
,
col
=
"red"
)
lines
(
lines
(
curves
$
concentration
,
curves
$
concentration
,
curves
$
effect_tox_env
,
curves
$
effect_tox_env
,
col
=
"orange"
,
col
=
"orange"
,
lty
=
2
lty
=
2
)
)
}
points
(
model
$
args
$
concentration
,
model
$
args
$
effect_tox_observed
,
pch
=
16
,
col
=
"blue"
)
if
(
model
$
with_env
)
{
# TODO: merge this with the same condition above.
points
(
points
(
model
$
args
$
concentration
,
concentration
,
model
$
args
$
effect_tox_env_observed
,
model
$
args
$
effect_tox_env_observed
,
pch
=
16
,
pch
=
16
,
col
=
"red"
col
=
"red"
)
)
}
}
axis
(
1
,
at
=
log_ticks
$
major
,
labels
=
log_ticks
$
major_labels
)
axis
(
1
,
at
=
log_ticks
$
major
,
labels
=
log_ticks
$
major_labels
)
axis
(
1
,
at
=
log_ticks
$
minor
,
labels
=
FALSE
,
tcl
=
-0.25
)
axis
(
1
,
at
=
log_ticks
$
minor
,
labels
=
FALSE
,
tcl
=
-0.25
)
plotrix
::
axis.break
(
1
,
breakpos
=
temp
$
axis_break_conc
)
plotrix
::
axis.break
(
1
,
breakpos
=
temp
$
axis_break_conc
)
if
(
show_legend
)
{
if
(
show_legend
)
{
# TODO: Maybe do proper subscript in legend
legend_text
<-
c
(
"tox"
,
"tox + sys"
)
# TODO: Add simple models to the legend
legend_pch
<-
c
(
NA
,
16
)
legend_text
<-
c
(
legend_lty
<-
c
(
2
,
1
)
"effect (tox+sys)"
,
legend_col
<-
c
(
"deepskyblue"
,
"blue"
)
"effect (tox+env+sys)"
,
if
(
model
$
with_env
)
{
"toxicant effect"
,
legend_text
<-
c
(
legend_text
,
"tox + env"
,
"tox + env + sys"
)
"tox_env effect"
legend_pch
<-
c
(
legend_pch
,
NA
,
16
)
)
legend_lty
<-
c
(
legend_lty
,
2
,
1
)
legend_pch
<-
c
(
16
,
16
,
NA
,
NA
)
legend_col
<-
c
(
legend_col
,
"orange"
,
"red"
)
legend_lty
<-
c
(
1
,
1
,
2
,
2
)
}
legend_col
<-
c
(
"blue"
,
"red"
,
"deepskyblue"
,
"orange"
)
if
(
show_simple_model
)
{
if
(
!
model
$
with_env
)
{
legend_text
<-
c
(
legend_text
,
"tox (LL5)"
,
"tox + env (LL5)"
)
keep
<-
c
(
1
,
3
)
legend_pch
<-
c
(
legend_pch
,
NA
,
NA
)
legend_text
<-
legend_text
[
keep
]
legend_lty
<-
c
(
legend_lty
,
4
,
4
)
legend_pch
<-
legend_pch
[
keep
]
legend_col
<-
c
(
legend_col
,
"darkblue"
,
"darkred"
)
legend_lty
<-
legend_lty
[
keep
]
legend_col
<-
legend_col
[
keep
]
}
}
legend
(
legend
(
"topright"
,
"topright"
,
...
...
This diff is collapsed.
Click to expand it.
R/plot_system_stress.R
+
12
−
13
View file @
0f474df3
...
@@ -9,8 +9,7 @@ plot_system_stress <- function(model, show_legend = FALSE) {
...
@@ -9,8 +9,7 @@ plot_system_stress <- function(model, show_legend = FALSE) {
curves
<-
temp
$
curves
curves
<-
temp
$
curves
axis_break_conc
<-
temp
$
axis_break_conc
axis_break_conc
<-
temp
$
axis_break_conc
log_ticks
<-
get_log_ticks
(
curves
$
concentration
)
log_ticks
<-
get_log_ticks
(
curves
$
concentration
)
# FIXME: Don't overwrite this arg. Make a new variable instead.
concentration
<-
c
(
curves
$
concentration
[
1
],
model
$
args
$
concentration
[
-1
])
model
$
args
$
concentration
[
1
]
<-
curves
$
concentration
[
1
]
plot
(
plot
(
NA
,
NA
,
...
@@ -24,17 +23,19 @@ plot_system_stress <- function(model, show_legend = FALSE) {
...
@@ -24,17 +23,19 @@ plot_system_stress <- function(model, show_legend = FALSE) {
las
=
1
,
las
=
1
,
bty
=
"L"
bty
=
"L"
)
)
lines
(
lines
(
curves
$
concentration
,
curves
$
concentration
,
curves
$
sys_stress_tox
,
curves
$
sys_stress_tox
,
col
=
"blue"
col
=
"blue"
)
)
points
(
points
(
model
$
args
$
concentration
,
concentration
,
model
$
sys_stress_tox
,
model
$
sys_stress_tox
,
pch
=
16
,
pch
=
16
,
col
=
"blue"
col
=
"blue"
)
)
if
(
model
$
with_env
)
{
if
(
model
$
with_env
)
{
lines
(
lines
(
curves
$
concentration
,
curves
$
concentration
,
...
@@ -42,25 +43,23 @@ plot_system_stress <- function(model, show_legend = FALSE) {
...
@@ -42,25 +43,23 @@ plot_system_stress <- function(model, show_legend = FALSE) {
col
=
"red"
col
=
"red"
)
)
points
(
points
(
model
$
args
$
concentration
,
concentration
,
model
$
sys_stress_tox_env
,
model
$
sys_stress_tox_env
,
pch
=
16
,
pch
=
16
,
col
=
"red"
col
=
"red"
)
)
}
}
axis
(
1
,
at
=
log_ticks
$
major
,
labels
=
log_ticks
$
major_labels
)
axis
(
1
,
at
=
log_ticks
$
major
,
labels
=
log_ticks
$
major_labels
)
axis
(
1
,
at
=
log_ticks
$
minor
,
labels
=
FALSE
,
tcl
=
-0.25
)
axis
(
1
,
at
=
log_ticks
$
minor
,
labels
=
FALSE
,
tcl
=
-0.25
)
plotrix
::
axis.break
(
1
,
breakpos
=
axis_break_conc
)
plotrix
::
axis.break
(
1
,
breakpos
=
axis_break_conc
)
if
(
show_legend
)
{
if
(
show_legend
)
{
legend_text
<-
c
(
legend_text
<-
c
(
"tox"
)
# TODO: Maybe do proper subscript in legend
legend_col
<-
c
(
"blue"
)
"system stress (tox)"
,
if
(
model
$
with_env
)
{
"system stress (tox+env)"
legend_text
<-
c
(
legend_text
,
"tox + env"
)
)
legend_col
<-
c
(
legend_col
,
"red"
)
legend_col
<-
c
(
"blue"
,
"red"
)
if
(
!
model
$
with_env
)
{
legend_text
<-
legend_text
[
1
]
legend_col
<-
legend_col
[
1
]
}
}
legend
(
legend
(
"topright"
,
"topright"
,
...
...
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