diff --git a/src/axes.jl b/src/axes.jl index 9f4da0b1..db4137e3 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -212,12 +212,20 @@ function optimal_ticks_and_labels(axis::Axis, ticks = nothing) 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) else # there was an override for the formatter... use that on the unscaled ticks map(formatter, unscaled_ticks) + # if the formatter left us with numbers, still apply the default formatter + # However it leave us with the problem of unicode number decoding by the backend + # if eltype(unscaled_ticks) <: Number + # Showoff.showoff(unscaled_ticks, :auto) + # end end else # no finite ticks to show... diff --git a/src/backends/gr.jl b/src/backends/gr.jl index cf369f64..b742eb15 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -225,8 +225,8 @@ function gr_polaraxes(rmin::Real, rmax::Real, sp::Subplot) sinf = sind.(a) cosf = cosd.(a) rtick_values, rtick_labels = get_ticks(yaxis) - if yaxis[:formatter] == :scientific && yaxis[:ticks] in (:auto, :native) - rtick_labels = convert_sci_unicode(rtick_labels) + if yaxis[:formatter] in (:scientific, :auto) && yaxis[:ticks] in (:auto, :native) + rtick_labels = convert_sci_unicode.(rtick_labels) end #draw angular grid @@ -888,7 +888,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) # ensure correct dispatch in gr_text for automatic log ticks if xaxis[:scale] in _logScales dv = string(dv, "\\ ") - elseif xaxis[:formatter] == :scientific + elseif xaxis[:formatter] in (:scientific, :auto) dv = convert_sci_unicode(dv) end end @@ -907,7 +907,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) # ensure correct dispatch in gr_text for automatic log ticks if yaxis[:scale] in _logScales dv = string(dv, "\\ ") - elseif yaxis[:formatter] == :scientific + elseif yaxis[:formatter] in (:scientific, :auto) dv = convert_sci_unicode(dv) end end diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 51eb2565..2396000e 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -425,7 +425,8 @@ function pgf_axis(sp::Subplot, letter) push!(style, string(letter, "ticklabels = {\$", join(tick_labels,"\$,\$"), "\$}")) elseif axis[:showaxis] tick_labels = ispolar(sp) && letter == :x ? [ticks[2][3:end]..., "0", "45"] : ticks[2] - tick_labels = axis[:formatter] == :scientific ? string.("\$", convert_sci_unicode.(tick_labels), "\$") : tick_labels + tick_labels = ( axis[:formatter] in (:scientific, :auto) ? + string.("\$", convert_sci_unicode.(tick_labels), "\$") : tick_labels ) push!(style, string(letter, "ticklabels = {", join(tick_labels,","), "}")) else push!(style, string(letter, "ticklabels = {}")) diff --git a/src/backends/web.jl b/src/backends/web.jl index 36fd5d06..e38ad782 100644 --- a/src/backends/web.jl +++ b/src/backends/web.jl @@ -12,6 +12,7 @@ function standalone_html(plt::AbstractPlot; title::AbstractString = get(plt.attr