From f000fc77ff3f22613e18a2e77f288d4e612b8532 Mon Sep 17 00:00:00 2001 From: Patrick Jaap Date: Wed, 2 Oct 2024 10:32:24 +0200 Subject: [PATCH] GR backend: use textext for :log2 and :ln axis scaling (#4991) (#4993) This fixes #4871 Only the case of :log10 has been treated before. --- .zenodo.json | 4 ++++ PlotsBase/ext/GRExt.jl | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 42fbc2c8a..eb7341d1f 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -775,6 +775,10 @@ "affiliation": "The Alan Turing Institute", "name": "Penelope Yong", "type": "Other" + }, + { + "name": "Patrick Jaap", + "type": "Other" } ], "upload_type": "software" diff --git a/PlotsBase/ext/GRExt.jl b/PlotsBase/ext/GRExt.jl index 2e4490803..c354d17ce 100644 --- a/PlotsBase/ext/GRExt.jl +++ b/PlotsBase/ext/GRExt.jl @@ -431,7 +431,7 @@ end gr_inqtext(x, y, s) = gr_inqtext(x, y, string(s)) gr_inqtext(x, y, s::AbstractString) = - if (occursin('\\', s) || occursin("10^{", s)) && + if (occursin('\\', s) || occursin(r"10\^{|2\^{|e\^{", s)) && match(r".*\$[^\$]+?\$.*", String(s)) ≡ nothing GR.inqtextext(x, y, s) else @@ -440,7 +440,7 @@ gr_inqtext(x, y, s::AbstractString) = gr_text(x, y, s) = gr_text(x, y, string(s)) gr_text(x, y, s::AbstractString) = - if (occursin('\\', s) || occursin("10^{", s)) && + if (occursin('\\', s) || occursin(r"10\^{|2\^{|e\^{", s)) && match(r".*\$[^\$]+?\$.*", String(s)) ≡ nothing GR.textext(x, y, s) else