From 20b96c8b1240c75065fd6d528d0f2a8463595c15 Mon Sep 17 00:00:00 2001
From: Sebastian Henz <sebastian.henz@ufz.de>
Date: Tue, 5 May 2020 13:44:45 +0200
Subject: [PATCH] Exlain the axis gap in the docu and comments, closes #24.

---
 R/ecxsys.R    | 14 +++++++++-----
 man/ecxsys.Rd |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/R/ecxsys.R b/R/ecxsys.R
index 3ac31f3..f3a69ce 100644
--- a/R/ecxsys.R
+++ b/R/ecxsys.R
@@ -82,7 +82,7 @@
 #'     The control is approximated by the lowest non-control concentration times
 #'     1e-7. The additional column \code{concentration_for_plots} is used by the
 #'     plotting functions of this package to approximate the control and
-#'     generate a break in the concentration axis.}
+#'     generate a nice concentration axis.}
 #'   }
 #'
 #' @examples model <- ecxsys(
@@ -315,7 +315,11 @@ ecxsys <- function(concentration,
     )
     output$curves <- predict_ecxsys(output, curves_concentration)
 
-    conc_axis <- adjust_plot_concentrations(
+    # Add a column of concentrations which helps in plotting. It does not make
+    # sense to show concentrations many orders of magnitude lower than the
+    # lowest measured concentration. So this cuts out a large chunk and raises
+    # the concentrations left of the cut so they make a nicer axis.
+    conc_axis <- make_axis_concentrations(
         curves_concentration,
         min_conc,
         conc_adjust_factor
@@ -443,9 +447,9 @@ interpolate <- function(x, to_index, n_new, conc = FALSE) {
 }
 
 
-adjust_plot_concentrations <- function(concentration,
-                                       min_conc,
-                                       conc_adjust_factor) {
+make_axis_concentrations <- function(concentration,
+                                     min_conc,
+                                     conc_adjust_factor) {
     # Deals with the concentrations which are unnecessary for plotting. This
     # means it removes the concentrations in the gap and increases the
     # concentrations below the gap.
diff --git a/man/ecxsys.Rd b/man/ecxsys.Rd
index 25fecda..c31e438 100644
--- a/man/ecxsys.Rd
+++ b/man/ecxsys.Rd
@@ -65,7 +65,7 @@ A list (of class ecxsys) containing many different objects of which
     The control is approximated by the lowest non-control concentration times
     1e-7. The additional column \code{concentration_for_plots} is used by the
     plotting functions of this package to approximate the control and
-    generate a break in the concentration axis.}
+    generate a nice concentration axis.}
   }
 }
 \description{
-- 
GitLab