aboutsummaryrefslogtreecommitdiff
path: root/R/plot.mmkin.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-09-02 16:14:50 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-09-02 16:14:50 +0200
commitee99cf40fdf6d986a909010d18063ad032f69899 (patch)
treea122d1249db9b27a2bc45a06b4ed05a33b8fb9ba /R/plot.mmkin.R
parent9ffec8b386646c51d1458f9c9c7b3124a8d9c91c (diff)
Some changes to improve plots on beamer slides
Diffstat (limited to 'R/plot.mmkin.R')
-rw-r--r--R/plot.mmkin.R25
1 files changed, 15 insertions, 10 deletions
diff --git a/R/plot.mmkin.R b/R/plot.mmkin.R
index c9d98718..ef80949c 100644
--- a/R/plot.mmkin.R
+++ b/R/plot.mmkin.R
@@ -18,6 +18,7 @@
plot.mmkin <- function(x, main = "auto", legends = 1,
resplot = c("time", "errmod"),
+ show_errmin = TRUE,
errmin_var = "All data", errmin_digits = 3,
cex = 0.7, rel.height.middle = 0.9, ...) {
n.m <- nrow(x)
@@ -83,23 +84,27 @@ plot.mmkin <- function(x, main = "auto", legends = 1,
datasets = colnames(x)[i.fit],
none = "")
- chi2 <- signif(100 * mkinerrmin(fit)[errmin_var, "err.min"], errmin_digits)
-
- # Use LateX if the current plotting device is tikz
- if (names(dev.cur()) == "tikz output") {
- chi2_text <- paste0(fit_name, " $\\chi^2$ error level = ", chi2, "\\%")
- } else {
- chi2_perc <- paste0(chi2, "%")
- chi2_text <- bquote(.(fit_name) ~ chi^2 ~ "error level" == .(chi2_perc))
+ if (show_errmin) {
+ chi2 <- signif(100 * mkinerrmin(fit)[errmin_var, "err.min"], errmin_digits)
+
+ # Use LateX if the current plotting device is tikz
+ if (names(dev.cur()) == "tikz output") {
+ chi2_text <- paste0(fit_name, " $\\chi^2$ error level = ", chi2, "\\%")
+ } else {
+ chi2_perc <- paste0(chi2, "%")
+ chi2_text <- bquote(.(fit_name) ~ chi^2 ~ "error level" == .(chi2_perc))
+ }
+ mtext(chi2_text, cex = cex, line = 0.4)
}
- mtext(chi2_text, cex = cex, line = 0.4)
if (resplot == "time") {
mkinresplot(fit, legend = FALSE, ...)
} else {
mkinerrplot(fit, legend = FALSE, ...)
}
- mtext(paste(fit_name, "residuals"), cex = cex, line = 0.4)
+ if (show_errmin) {
+ mtext(paste(fit_name, "residuals"), cex = cex, line = 0.4)
+ }
}
par(oldpar, no.readonly = TRUE)

Contact - Imprint