better exopnents (#2786)
This commit is contained in:
parent
fb40ed1f59
commit
8b2d3e926a
14
src/axes.jl
14
src/axes.jl
@ -181,16 +181,10 @@ function optimal_ticks_and_labels(sp::Subplot, axis::Axis, ticks = nothing)
|
|||||||
|
|
||||||
labels = if any(isfinite, unscaled_ticks)
|
labels = if any(isfinite, unscaled_ticks)
|
||||||
formatter = axis[:formatter]
|
formatter = axis[:formatter]
|
||||||
if formatter == :auto
|
if formatter in (:auto, :plain, :scientific, :engineering)
|
||||||
# the default behavior is to make strings of the scaled values and then apply the labelfunc
|
map(labelfunc(scale, backend()), Showoff.showoff(scaled_ticks, formatter))
|
||||||
map(labelfunc(scale, backend()), Showoff.showoff(scaled_ticks, :auto))
|
elseif formatter == :latex
|
||||||
elseif formatter == :plain
|
map(x -> string("\$", replace(convert_sci_unicode(x), '×' => "\\times"), "\$"), Showoff.showoff(unscaled_ticks, :auto))
|
||||||
# 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))
|
|
||||||
else
|
else
|
||||||
# there was an override for the formatter... use that on the unscaled ticks
|
# there was an override for the formatter... use that on the unscaled ticks
|
||||||
map(formatter, unscaled_ticks)
|
map(formatter, unscaled_ticks)
|
||||||
|
|||||||
@ -182,7 +182,7 @@ function labelfunc(scale::Symbol, backend::PyPlotBackend)
|
|||||||
elseif scale == :ln
|
elseif scale == :ln
|
||||||
x -> PyPlot.LaTeXStrings.latexstring("e^{$x}")
|
x -> PyPlot.LaTeXStrings.latexstring("e^{$x}")
|
||||||
else
|
else
|
||||||
string
|
x -> PyPlot.LaTeXStrings.latexstring(convert_sci_unicode(x))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user