From 20508bf29a8108a71ce8364cf393f62c33e4262a Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Mon, 15 Jun 2020 13:40:04 +0900 Subject: [PATCH] better exopnents --- src/axes.jl | 14 ++++---------- src/backends/pyplot.jl | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/axes.jl b/src/axes.jl index c4883a1f..87feabcc 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -181,16 +181,10 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing) labels = if any(isfinite, unscaled_ticks) formatter = axis[:formatter] - if formatter == :auto - # the default behavior is to make strings of the scaled values and then apply the labelfunc - map(labelfunc(scale, backend()), Showoff.showoff(scaled_ticks, :auto)) - elseif formatter == :plain - # Leave the numbers in plain format - map(labelfunc(scale, backend()), Showoff.showoff(scaled_ticks, :plain)) - elseif formatter == :scientific - Showoff.showoff(unscaled_ticks, :scientific) - elseif formatter == :latex - map(x -> string("\$", replace(convert_sci_unicode(x), '×' => "\\times"), "\$"), Showoff.showoff(unscaled_ticks, :auto)) + if formatter in (:auto, :plain, :scientific, :engineering) + map(labelfunc(scale, backend()), Showoff.showoff(scaled_ticks, formatter)) + elseif formatter == :latex + map(x -> string("\$", replace(convert_sci_unicode(x), '×' => "\\times"), "\$"), Showoff.showoff(unscaled_ticks, :auto)) else # there was an override for the formatter... use that on the unscaled ticks map(formatter, unscaled_ticks) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index e7ff3019..7d21a2af 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -182,7 +182,7 @@ function labelfunc(scale::Symbol, backend::PyPlotBackend) elseif scale == :ln x -> PyPlot.LaTeXStrings.latexstring("e^{$x}") else - string + x -> PyPlot.LaTeXStrings.latexstring(convert_sci_unicode(x)) end end