Implement :native ticks option.
This commit is contained in:
parent
3ac9f3d9cc
commit
06466b060f
@ -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...
|
||||
|
||||
@ -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, "\\ ")
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user