From 87d63e649da5e12409c50cb06d3d2a01e9880759 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 15 Dec 2017 17:25:21 +0100 Subject: =?UTF-8?q?Improve=20handling=20of=20=C2=B5=20in=20y=20axis=20for?= =?UTF-8?q?=20plot.TOXSWA=5Fcwa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/TOXSWA_cwa.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'R') diff --git a/R/TOXSWA_cwa.R b/R/TOXSWA_cwa.R index 81df85f..eacd58f 100644 --- a/R/TOXSWA_cwa.R +++ b/R/TOXSWA_cwa.R @@ -129,7 +129,13 @@ plot.TOXSWA_cwa <- function(x, time_column = c("datetime", "t", "t_firstjan", "t t_rel_to_max = "Time relative to maximum concentration [days]") } if (identical(ylab, "default")) { - ylab = paste( ifelse(total, "Total concentration", "Concentration"), "[\u03bcg/L]") + # Use LateX if the current plotting device is tikz + if (names(dev.cur()) == "tikz output") { + ylab = paste( ifelse(total, "Total concentration", "Concentration"), "[$\\mu$g/L]") + } else { + conc_string <- ifelse(total, "Total concentration", "Concentration") + ylab = bquote(.(conc_string) ~ group("[", mu*g/L, "]")) + } } if (add) { lines(plot_data, xlab = xlab, ylab = ylab, ...) -- cgit v1.2.1