diff --git a/src/axes.jl b/src/axes.jl index d62667fb..855f8d97 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -234,6 +234,9 @@ function get_ticks(axis::Axis) ticks = _transform_ticks(axis[:ticks]) ticks in (nothing, false) && return nothing + # treat :native ticks as :auto + ticks = ticks == :native ? :auto : ticks + dvals = axis[:discrete_values] cv, dv = if !isempty(dvals) && ticks == :auto # discrete ticks... diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 89c3c355..90e2a5a6 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -222,7 +222,7 @@ 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] == :auto + if yaxis[:formatter] == :scientific && yaxis[:ticks] in (:auto, :native) rtick_labels = convert_sci_unicode(rtick_labels) end @@ -884,7 +884,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) # use xor ($) to get the right y coords xi, yi = GR.wctondc(cv, sp[:framestyle] == :origin ? 0 : xor(flip, mirror) ? ymax : ymin) # @show cv dv ymin xi yi flip mirror (flip $ mirror) - if xaxis[:ticks] == :auto + if xaxis[:ticks] in (:auto, :native) # ensure correct dispatch in gr_text for automatic log ticks if xaxis[:scale] in _logScales dv = string(dv, "\\ ") @@ -903,7 +903,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) # use xor ($) to get the right y coords xi, yi = GR.wctondc(sp[:framestyle] == :origin ? 0 : xor(flip, mirror) ? xmax : xmin, cv) # @show cv dv xmin xi yi - if yaxis[:ticks] == :auto + if yaxis[:ticks] in (:auto, :native) # ensure correct dispatch in gr_text for automatic log ticks if yaxis[:scale] in _logScales dv = string(dv, "\\ ") diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 1956f1b3..d22b5b1a 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -314,7 +314,7 @@ function pgf_axis(sp::Subplot, letter) kw[Symbol(letter,:max)] = lims[2] end - if !(axis[:ticks] in (nothing, false, :none)) && framestyle != :none + if !(axis[:ticks] in (nothing, false, :none, :native)) && framestyle != :none ticks = get_ticks(axis) #pgf plot ignores ticks with angle below 90 when xmin = 90 so shift values tick_values = ispolar(sp) && letter == :x ? [rad2deg.(ticks[1])[3:end]..., 360, 405] : ticks[1] diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 0330e149..014d7b21 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -273,8 +273,8 @@ function plotly_axis(axis::Axis, sp::Subplot) end # ticks - ticks = get_ticks(axis) - if ticks != :auto + if axis[:ticks] != :native + ticks = get_ticks(axis) ttype = ticksType(ticks) if ttype == :ticks ax[:tickmode] = "array" diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index f3823e0a..4801e38e 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1069,7 +1069,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) if sp[:framestyle] == :origin && length(ticks) > 1 ticks[2][ticks[1] .== 0] = "" end - py_set_ticks(ax, ticks, letter) + axis[:ticks] != :native ? py_set_ticks(ax, ticks, letter) : nothing pyaxis[:set_tick_params](direction = axis[:tick_direction] == :out ? "out" : "in") ax[Symbol("set_", letter, "label")](axis[:guide]) if get(axis.d, :flip, false)