allow turning on/off the axes border
This commit is contained in:
parent
5945196a4f
commit
be4a374122
@ -93,6 +93,7 @@ const _arg_desc = KW(
|
|||||||
:bottom_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the bottom of the subplot.",
|
:bottom_margin => "Measure (multiply by `mm`, `px`, etc) or `:match` (matches `:margin`). Specifies the extra padding on the bottom of the subplot.",
|
||||||
:subplot_index => "Integer. Internal (not set by user). Specifies the index of this subplot in the Plot's `plt.subplot` list.",
|
:subplot_index => "Integer. Internal (not set by user). Specifies the index of this subplot in the Plot's `plt.subplot` list.",
|
||||||
:colorbar_title => "String. Title of colorbar.",
|
:colorbar_title => "String. Title of colorbar.",
|
||||||
|
:draw_axes_border => "Bool. Draw a border around the axes.",
|
||||||
|
|
||||||
# axis args
|
# axis args
|
||||||
:guide => "String. Axis guide (label).",
|
:guide => "String. Axis guide (label).",
|
||||||
|
|||||||
@ -282,6 +282,7 @@ const _subplot_defaults = KW(
|
|||||||
:bottom_margin => :match,
|
:bottom_margin => :match,
|
||||||
:subplot_index => -1,
|
:subplot_index => -1,
|
||||||
:colorbar_title => "",
|
:colorbar_title => "",
|
||||||
|
:draw_axes_border => false,
|
||||||
)
|
)
|
||||||
|
|
||||||
const _axis_defaults = KW(
|
const _axis_defaults = KW(
|
||||||
@ -493,6 +494,7 @@ add_aliases(:orientation, :direction, :dir)
|
|||||||
add_aliases(:inset_subplots, :inset, :floating)
|
add_aliases(:inset_subplots, :inset, :floating)
|
||||||
add_aliases(:gridlinewidth, :gridwidth, :grid_linewidth, :grid_width, :gridlw, :grid_lw)
|
add_aliases(:gridlinewidth, :gridwidth, :grid_linewidth, :grid_width, :gridlw, :grid_lw)
|
||||||
add_aliases(:gridstyle, :grid_style, :gridlinestyle, :grid_linestyle, :grid_ls, :gridls)
|
add_aliases(:gridstyle, :grid_style, :gridlinestyle, :grid_linestyle, :grid_ls, :gridls)
|
||||||
|
add_aliases(:draw_axes_border, :axes_border, :show_axes_border)
|
||||||
|
|
||||||
|
|
||||||
# add all pluralized forms to the _keyAliases dict
|
# add all pluralized forms to the _keyAliases dict
|
||||||
|
|||||||
@ -502,10 +502,10 @@ function axis_drawing_info(sp::Subplot)
|
|||||||
t2 = invf(f(ymax) - 0.015*(f(ymax)-f(ymin)))
|
t2 = invf(f(ymax) - 0.015*(f(ymax)-f(ymin)))
|
||||||
|
|
||||||
push!(xspine_segs, (xmin,ymin), (xmax,ymin)) # bottom spine
|
push!(xspine_segs, (xmin,ymin), (xmax,ymin)) # bottom spine
|
||||||
# push!(xspine_segs, (xmin,ymax), (xmax,ymax)) # top spine
|
sp[:draw_axes_border] && push!(xspine_segs, (xmin,ymax), (xmax,ymax)) # top spine
|
||||||
for xtick in xticks[1]
|
for xtick in xticks[1]
|
||||||
push!(xspine_segs, (xtick, ymin), (xtick, t1)) # bottom tick
|
push!(xspine_segs, (xtick, ymin), (xtick, t1)) # bottom tick
|
||||||
# push!(xspine_segs, (xtick, ymax), (xtick, t2)) # top tick
|
# sp[:draw_axes_border] && push!(xspine_segs, (xtick, ymax), (xtick, t2)) # top tick
|
||||||
xaxis[:grid] && push!(xgrid_segs, (xtick, t1), (xtick, t2)) # vertical grid
|
xaxis[:grid] && push!(xgrid_segs, (xtick, t1), (xtick, t2)) # vertical grid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -517,10 +517,10 @@ function axis_drawing_info(sp::Subplot)
|
|||||||
t2 = invf(f(xmax) - 0.015*(f(xmax)-f(xmin)))
|
t2 = invf(f(xmax) - 0.015*(f(xmax)-f(xmin)))
|
||||||
|
|
||||||
push!(yspine_segs, (xmin,ymin), (xmin,ymax)) # left spine
|
push!(yspine_segs, (xmin,ymin), (xmin,ymax)) # left spine
|
||||||
# push!(yspine_segs, (xmax,ymin), (xmax,ymax)) # right spine
|
sp[:draw_axes_border] && push!(yspine_segs, (xmax,ymin), (xmax,ymax)) # right spine
|
||||||
for ytick in yticks[1]
|
for ytick in yticks[1]
|
||||||
push!(yspine_segs, (xmin, ytick), (t1, ytick)) # left tick
|
push!(yspine_segs, (xmin, ytick), (t1, ytick)) # left tick
|
||||||
# push!(yspine_segs, (xmax, ytick), (t2, ytick)) # right tick
|
# sp[:draw_axes_border] && push!(yspine_segs, (xmax, ytick), (t2, ytick)) # right tick
|
||||||
yaxis[:grid] && push!(ygrid_segs, (t1, ytick), (t2, ytick)) # horizontal grid
|
yaxis[:grid] && push!(ygrid_segs, (t1, ytick), (t2, ytick)) # horizontal grid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -39,7 +39,8 @@ const _glvisualize_attr = merge_with_base_supported([
|
|||||||
:clims,
|
:clims,
|
||||||
:inset_subplots,
|
:inset_subplots,
|
||||||
:dpi,
|
:dpi,
|
||||||
:hover
|
:hover,
|
||||||
|
:draw_axes_border,
|
||||||
])
|
])
|
||||||
const _glvisualize_seriestype = [
|
const _glvisualize_seriestype = [
|
||||||
:path, :shape,
|
:path, :shape,
|
||||||
|
|||||||
@ -32,6 +32,7 @@ const _gr_attr = merge_with_base_supported([
|
|||||||
:inset_subplots,
|
:inset_subplots,
|
||||||
:bar_width,
|
:bar_width,
|
||||||
:arrow,
|
:arrow,
|
||||||
|
:draw_axes_border,
|
||||||
])
|
])
|
||||||
const _gr_seriestype = [
|
const _gr_seriestype = [
|
||||||
:path, :scatter,
|
:path, :scatter,
|
||||||
|
|||||||
@ -32,6 +32,7 @@ const _pyplot_attr = merge_with_base_supported([
|
|||||||
:inset_subplots,
|
:inset_subplots,
|
||||||
:dpi,
|
:dpi,
|
||||||
:colorbar_title,
|
:colorbar_title,
|
||||||
|
:draw_axes_border,
|
||||||
])
|
])
|
||||||
const _pyplot_seriestype = [
|
const _pyplot_seriestype = [
|
||||||
:path, :steppre, :steppost, :shape,
|
:path, :steppre, :steppost, :shape,
|
||||||
@ -1088,6 +1089,12 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
|
|
||||||
# this sets the bg color inside the grid
|
# this sets the bg color inside the grid
|
||||||
ax[set_facecolor_sym](py_color(sp[:background_color_inside]))
|
ax[set_facecolor_sym](py_color(sp[:background_color_inside]))
|
||||||
|
|
||||||
|
if !sp[:draw_axes_border]
|
||||||
|
# hide the right and top spines
|
||||||
|
ax[:spines]["right"][:set_visible](false)
|
||||||
|
ax[:spines]["top"][:set_visible](false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
py_drawfig(fig)
|
py_drawfig(fig)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user