Merge pull request #3458 from daschw/tickmarks
add `tick_direction=:none` option to hide tick marks
This commit is contained in:
commit
57ba6aa5a9
@ -165,7 +165,7 @@ const _arg_desc = KW(
|
||||
:minorgridalpha => "Number in [0,1]. The alpha/opacity override for the minorgrid lines.",
|
||||
:minorgridstyle => "Symbol. Style of the minor grid lines. Choose from $(_allStyles)",
|
||||
:minorgridlinewidth => "Number. Width of the minor grid lines (in pixels)",
|
||||
:tick_direction => "Symbol. Direction of the ticks. `:in` or `:out`",
|
||||
:tick_direction => "Symbol. Direction of the ticks. `:in`, `:out` or `:none`",
|
||||
:showaxis => "Bool, Symbol or String. Show the axis. `true`, `false`, `:show`, `:hide`, `:yes`, `:no`, `:x`, `:y`, `:z`, `:xy`, ..., `:all`, `:off`",
|
||||
:widen => "Bool. Widen the axis limits by a small factor to avoid cut-off markers and lines at the borders. Defaults to `true`.",
|
||||
:draw_arrow => "Bool. Draw arrow at the end of the axis.",
|
||||
|
||||
10
src/axes.jl
10
src/axes.jl
@ -697,6 +697,7 @@ function axis_drawing_info(sp, letter)
|
||||
if !(ax[:ticks] in (:none, nothing, false))
|
||||
f = RecipesPipeline.scale_func(oax[:scale])
|
||||
invf = RecipesPipeline.inverse_scale_func(oax[:scale])
|
||||
if ax[:tick_direction] !== :none
|
||||
tick_start, tick_stop = if sp[:framestyle] == :origin
|
||||
t = invf(f(0) + 0.012 * (f(oamax) - f(oamin)))
|
||||
(-t, t)
|
||||
@ -705,9 +706,10 @@ function axis_drawing_info(sp, letter)
|
||||
t = invf(f(oa1) + 0.012 * (f(oa2) - f(oa1)) * ticks_in)
|
||||
(oa1, t)
|
||||
end
|
||||
end
|
||||
|
||||
for tick in ticks[1]
|
||||
if ax[:showaxis]
|
||||
if ax[:showaxis] && ax[:tick_direction] !== :none
|
||||
push!(
|
||||
tick_segments,
|
||||
reverse_if((tick, tick_start), isy),
|
||||
@ -834,6 +836,7 @@ function axis_drawing_info_3d(sp, letter)
|
||||
if !(ax[:ticks] in (:none, nothing, false))
|
||||
f = RecipesPipeline.scale_func(nax[:scale])
|
||||
invf = RecipesPipeline.inverse_scale_func(nax[:scale])
|
||||
if ax[:tick_direction] !== :none
|
||||
tick_start, tick_stop = if sp[:framestyle] == :origin
|
||||
t = invf(f(0) + 0.012 * (f(namax) - f(namin)))
|
||||
(-t, t)
|
||||
@ -842,10 +845,11 @@ function axis_drawing_info_3d(sp, letter)
|
||||
t = invf(f(na0) + 0.012 * (f(na1) - f(na0)) * ticks_in)
|
||||
(na0, t)
|
||||
end
|
||||
end
|
||||
|
||||
ga0, ga1 = sp[:framestyle] in (:origin, :zerolines) ? (namin, namax) : (na0, na1)
|
||||
for tick in ticks[1]
|
||||
if ax[:showaxis]
|
||||
if ax[:showaxis] && ax[:tick_direction] !== :none
|
||||
push!(
|
||||
tick_segments,
|
||||
sort_3d_axes(tick, tick_start, fa0, letter),
|
||||
@ -875,7 +879,7 @@ function axis_drawing_info_3d(sp, letter)
|
||||
(na0, t)
|
||||
end
|
||||
for tick in minor_ticks
|
||||
if ax[:showaxis]
|
||||
if ax[:showaxis] && ax[:tick_direction] !== :none
|
||||
push!(
|
||||
tick_segments,
|
||||
sort_3d_axes(tick, tick_start, fa0, letter),
|
||||
|
||||
@ -1278,11 +1278,18 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter)
|
||||
else
|
||||
push!(opt, string(letter, "ticklabels") => "{}")
|
||||
end
|
||||
if axis[:tick_direction] === :none
|
||||
push!(
|
||||
opt,
|
||||
string(letter, "tick style") => "draw=none",
|
||||
)
|
||||
else
|
||||
push!(
|
||||
opt,
|
||||
string(letter, "tick align") =>
|
||||
(axis[:tick_direction] == :out ? "outside" : "inside"),
|
||||
)
|
||||
end
|
||||
push!(
|
||||
opt, string(letter, "ticklabel style") => pgfx_get_ticklabel_style(sp, axis)
|
||||
)
|
||||
|
||||
@ -143,7 +143,8 @@ function plotly_axis(axis, sp, anchor = nothing, domain = nothing)
|
||||
:zerolinecolor => rgba_string(axis[:foreground_color_axis]),
|
||||
:showline => framestyle in (:box, :axes) && axis[:showaxis],
|
||||
:linecolor => rgba_string(plot_color(axis[:foreground_color_axis])),
|
||||
:ticks => axis[:tick_direction] == :out ? "outside" : "inside",
|
||||
:ticks => axis[:tick_direction] === :out ? "outside" :
|
||||
axis[:tick_direction] === :in ? "inside" : "",
|
||||
:mirror => framestyle == :box,
|
||||
:showticklabels => axis[:showaxis],
|
||||
)
|
||||
|
||||
@ -1022,7 +1022,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
cbar_axis."set_tick_params"(
|
||||
direction = axis[:tick_direction] == :out ? "out" : "in",
|
||||
width=py_thickness_scale(plt, intensity),
|
||||
length= 5 * py_thickness_scale(plt, intensity)
|
||||
length = axis[:tick_direction] == :none ? 0 : 5 * py_thickness_scale(plt, intensity)
|
||||
)
|
||||
|
||||
|
||||
@ -1137,7 +1137,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
pyaxis."set_tick_params"(
|
||||
direction = axis[:tick_direction] == :out ? "out" : "in",
|
||||
width=py_thickness_scale(plt, intensity),
|
||||
length= 5 * py_thickness_scale(plt, intensity)
|
||||
length = axis[:tick_direction] == :none ? 0 : 5 * py_thickness_scale(plt, intensity)
|
||||
)
|
||||
|
||||
getproperty(ax, Symbol("set_", letter, "label"))(axis[:guide])
|
||||
@ -1176,7 +1176,8 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
pyaxis."set_tick_params"(
|
||||
which = "minor",
|
||||
direction = axis[:tick_direction] == :out ? "out" : "in",
|
||||
width=py_thickness_scale(plt, intensity))
|
||||
length = axis[:tick_direction] == :none ? 0 : py_thickness_scale(plt, intensity),
|
||||
)
|
||||
end
|
||||
|
||||
if axis[:minorgrid]
|
||||
@ -1186,7 +1187,8 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
||||
pyaxis."set_tick_params"(
|
||||
which = "minor",
|
||||
direction = axis[:tick_direction] == :out ? "out" : "in",
|
||||
width=py_thickness_scale(plt, intensity))
|
||||
length = axis[:tick_direction] == :none ? 0 : py_thickness_scale(plt, intensity)
|
||||
)
|
||||
|
||||
pyaxis."grid"(true,
|
||||
which = "minor",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user