aboutsummaryrefslogtreecommitdiff
path: root/R/plot.mmkin.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-12-07 21:22:15 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2016-12-07 21:22:15 +0100
commit0e57bfcf262a2b2a6a4c8148353cdaed7dc91c9c (patch)
treeb0549f7448ce52fd82185c59b2700f92414da504 /R/plot.mmkin.R
parentdeca771bee44019b96e5562215ea45f5f902a339 (diff)
Use latex in plots when using tikzDevice
Diffstat (limited to 'R/plot.mmkin.R')
-rw-r--r--R/plot.mmkin.R12
1 files changed, 10 insertions, 2 deletions
diff --git a/R/plot.mmkin.R b/R/plot.mmkin.R
index 562bbb71..ee7075d3 100644
--- a/R/plot.mmkin.R
+++ b/R/plot.mmkin.R
@@ -79,8 +79,16 @@ plot.mmkin <- function(x, main = "auto", legends = 1, errmin_var = "All data", e
datasets = colnames(x)[i.fit],
none = "")
- chi2 <- paste0(signif(100 * mkinerrmin(fit)[errmin_var, "err.min"], errmin_digits), "%")
- mtext(bquote(.(fit_name) ~ chi^2 ~ "error level" == .(chi2)), cex = cex, line = 0.4)
+ 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)
mkinresplot(fit, legend = FALSE, ...)
mtext(paste(fit_name, "residuals"), cex = cex, line = 0.4)

Contact - Imprint