Treat minor and major ticks separately
has an effect on GR only
This commit is contained in:
parent
532710e6bf
commit
824b7ce4f4
@ -124,6 +124,8 @@ const _arg_desc = KW(
|
|||||||
:tickfontvalign => "Symbol. Font vertical alignment of tick labels: :vcenter, :top, :bottom or :center",
|
:tickfontvalign => "Symbol. Font vertical alignment of tick labels: :vcenter, :top, :bottom or :center",
|
||||||
:tickfontrotation => "Real. Font rotation of tick labels",
|
:tickfontrotation => "Real. Font rotation of tick labels",
|
||||||
:tickfontcolor => "Color Type. Font color of tick labels",
|
:tickfontcolor => "Color Type. Font color of tick labels",
|
||||||
|
:foreground_color_tick => "Color Type. Color of major ticks.",
|
||||||
|
:foreground_color_minortick => "Color Type. Color of minor ticks.",
|
||||||
:guidefontfamily => "String or Symbol. Font family of axes guides.",
|
:guidefontfamily => "String or Symbol. Font family of axes guides.",
|
||||||
:guidefontsize => "Integer. Font pointsize of axes guides.",
|
:guidefontsize => "Integer. Font pointsize of axes guides.",
|
||||||
:guidefonthalign => "Symbol. Font horizontal alignment of axes guides: :hcenter, :left, :right or :center",
|
:guidefonthalign => "Symbol. Font horizontal alignment of axes guides: :hcenter, :left, :right or :center",
|
||||||
|
|||||||
@ -363,6 +363,8 @@ const _axis_defaults = KW(
|
|||||||
:tickfontvalign => :vcenter,
|
:tickfontvalign => :vcenter,
|
||||||
:tickfontrotation => 0.0,
|
:tickfontrotation => 0.0,
|
||||||
:tickfontcolor => :match,
|
:tickfontcolor => :match,
|
||||||
|
:foreground_color_tick => :match,
|
||||||
|
:foreground_color_minortick => :match,
|
||||||
:guidefontfamily => :match,
|
:guidefontfamily => :match,
|
||||||
:guidefontsize => 11,
|
:guidefontsize => 11,
|
||||||
:guidefonthalign => :hcenter,
|
:guidefonthalign => :hcenter,
|
||||||
@ -1283,6 +1285,8 @@ const _match_map2 = KW(
|
|||||||
:fontfamily_subplot => :fontfamily,
|
:fontfamily_subplot => :fontfamily,
|
||||||
:tickfontfamily => :fontfamily_subplot,
|
:tickfontfamily => :fontfamily_subplot,
|
||||||
:guidefontfamily => :fontfamily_subplot,
|
:guidefontfamily => :fontfamily_subplot,
|
||||||
|
:foreground_color_tick => :foreground_color_subplot,
|
||||||
|
:foreground_color_minortick => :foreground_color_subplot
|
||||||
)
|
)
|
||||||
|
|
||||||
# properly retrieve from plt.attr, passing `:match` to the correct key
|
# properly retrieve from plt.attr, passing `:match` to the correct key
|
||||||
@ -1466,6 +1470,8 @@ function _update_axis_colors(axis::Axis)
|
|||||||
color_or_nothing!(axis.plotattributes, :foreground_color_text)
|
color_or_nothing!(axis.plotattributes, :foreground_color_text)
|
||||||
color_or_nothing!(axis.plotattributes, :foreground_color_grid)
|
color_or_nothing!(axis.plotattributes, :foreground_color_grid)
|
||||||
color_or_nothing!(axis.plotattributes, :foreground_color_minor_grid)
|
color_or_nothing!(axis.plotattributes, :foreground_color_minor_grid)
|
||||||
|
color_or_nothing!(axis.plotattributes, :foreground_color_tick)
|
||||||
|
color_or_nothing!(axis.plotattributes, :foreground_color_minortick)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -598,6 +598,8 @@ function axis_drawing_info(sp::Subplot)
|
|||||||
ytick_segs = Segments(2)
|
ytick_segs = Segments(2)
|
||||||
xgrid_segs = Segments(2)
|
xgrid_segs = Segments(2)
|
||||||
ygrid_segs = Segments(2)
|
ygrid_segs = Segments(2)
|
||||||
|
xminortick_segs = Segments(2)
|
||||||
|
yminortick_segs = Segments(2)
|
||||||
xminorgrid_segs = Segments(2)
|
xminorgrid_segs = Segments(2)
|
||||||
yminorgrid_segs = Segments(2)
|
yminorgrid_segs = Segments(2)
|
||||||
xborder_segs = Segments(2)
|
xborder_segs = Segments(2)
|
||||||
@ -657,7 +659,7 @@ function axis_drawing_info(sp::Subplot)
|
|||||||
else
|
else
|
||||||
xor(xaxis[:mirror], yaxis[:flip]) ? (ymax, t2) : (ymin, t1)
|
xor(xaxis[:mirror], yaxis[:flip]) ? (ymax, t2) : (ymin, t1)
|
||||||
end
|
end
|
||||||
push!(xtick_segs, (xminortick, tick_start), (xminortick, tick_stop)) # bottom tick
|
push!(xminortick_segs, (xminortick, tick_start), (xminortick, tick_stop)) # bottom tick
|
||||||
end
|
end
|
||||||
# sp[:draw_axes_border] && push!(xaxis_segs, (xtick, ymax), (xtick, t2)) # top tick
|
# sp[:draw_axes_border] && push!(xaxis_segs, (xtick, ymax), (xtick, t2)) # top tick
|
||||||
xaxis[:minorgrid] && push!(xminorgrid_segs, (xminortick, ymin), (xminortick, ymax)) # vertical grid
|
xaxis[:minorgrid] && push!(xminorgrid_segs, (xminortick, ymin), (xminortick, ymax)) # vertical grid
|
||||||
@ -718,7 +720,7 @@ function axis_drawing_info(sp::Subplot)
|
|||||||
else
|
else
|
||||||
xor(yaxis[:mirror], xaxis[:flip]) ? (xmax, t2) : (xmin, t1)
|
xor(yaxis[:mirror], xaxis[:flip]) ? (xmax, t2) : (xmin, t1)
|
||||||
end
|
end
|
||||||
push!(ytick_segs, (tick_start, ytick), (tick_stop, ytick)) # left tick
|
push!(yminortick_segs, (tick_start, ytick), (tick_stop, ytick)) # left tick
|
||||||
end
|
end
|
||||||
# sp[:draw_axes_border] && push!(yaxis_segs, (xmax, ytick), (t2, ytick)) # right tick
|
# sp[:draw_axes_border] && push!(yaxis_segs, (xmax, ytick), (t2, ytick)) # right tick
|
||||||
yaxis[:minorgrid] && push!(yminorgrid_segs, (xmin, ytick), (xmax, ytick)) # horizontal grid
|
yaxis[:minorgrid] && push!(yminorgrid_segs, (xmin, ytick), (xmax, ytick)) # horizontal grid
|
||||||
@ -726,5 +728,5 @@ function axis_drawing_info(sp::Subplot)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
xticks, yticks, xaxis_segs, yaxis_segs, xtick_segs, ytick_segs, xgrid_segs, ygrid_segs, xminorgrid_segs, yminorgrid_segs, xborder_segs, yborder_segs
|
xticks, yticks, xaxis_segs, yaxis_segs, xtick_segs, ytick_segs, xgrid_segs, ygrid_segs, xminorgrid_segs, yminorgrid_segs, xborder_segs, yborder_segs, xminortick_segs, yminortick_segs
|
||||||
end
|
end
|
||||||
|
|||||||
@ -355,9 +355,11 @@ const _gr_attr = merge_with_base_supported([
|
|||||||
:legendfontrotation, :legendfontcolor,
|
:legendfontrotation, :legendfontcolor,
|
||||||
:tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign,
|
:tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign,
|
||||||
:tickfontrotation, :tickfontcolor,
|
:tickfontrotation, :tickfontcolor,
|
||||||
|
:foreground_color_tick, :foreground_color_minortick,
|
||||||
:guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign,
|
:guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign,
|
||||||
:guidefontrotation, :guidefontcolor,
|
:guidefontrotation, :guidefontcolor,
|
||||||
:grid, :gridalpha, :gridstyle, :gridlinewidth,
|
:grid, :gridalpha, :gridstyle, :gridlinewidth,
|
||||||
|
:minorgridalpha, :minorgridlinewidth,
|
||||||
:legend, :legendtitle, :colorbar, :colorbar_title,
|
:legend, :legendtitle, :colorbar, :colorbar_title,
|
||||||
:fill_z, :line_z, :marker_z, :levels,
|
:fill_z, :line_z, :marker_z, :levels,
|
||||||
:ribbon, :quiver,
|
:ribbon, :quiver,
|
||||||
|
|||||||
@ -764,7 +764,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
GR.setwindow(xmin, xmax, ymin, ymax)
|
GR.setwindow(xmin, xmax, ymin, ymax)
|
||||||
end
|
end
|
||||||
|
|
||||||
xticks, yticks, xspine_segs, yspine_segs, xtick_segs, ytick_segs, xgrid_segs, ygrid_segs, xminorgrid_segs, yminorgrid_segs, xborder_segs, yborder_segs = axis_drawing_info(sp)
|
xticks, yticks, xspine_segs, yspine_segs, xtick_segs, ytick_segs, xgrid_segs, ygrid_segs, xminorgrid_segs, yminorgrid_segs, xborder_segs, yborder_segs, xminortick_segs, yminortick_segs = axis_drawing_info(sp)
|
||||||
# @show xticks yticks #spine_segs grid_segs
|
# @show xticks yticks #spine_segs grid_segs
|
||||||
|
|
||||||
# draw the grid lines
|
# draw the grid lines
|
||||||
@ -810,26 +810,49 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
|
|||||||
# axis ticks
|
# axis ticks
|
||||||
if xaxis[:showaxis]
|
if xaxis[:showaxis]
|
||||||
if sp[:framestyle] in (:zerolines, :grid)
|
if sp[:framestyle] in (:zerolines, :grid)
|
||||||
gr_set_line(1, :solid, xaxis[:foreground_color_grid])
|
gr_set_line(1, :solid, xaxis[:foreground_color_tick])
|
||||||
gr_set_transparency(xaxis[:gridalpha])
|
gr_set_transparency(xaxis[:gridalpha])
|
||||||
else
|
else
|
||||||
gr_set_line(1, :solid, xaxis[:foreground_color_axis])
|
gr_set_line(1, :solid, xaxis[:foreground_color_tick])
|
||||||
end
|
end
|
||||||
GR.setclip(0)
|
GR.setclip(0)
|
||||||
gr_polyline(coords(xtick_segs)...)
|
gr_polyline(coords(xtick_segs)...)
|
||||||
end
|
end
|
||||||
if yaxis[:showaxis]
|
if yaxis[:showaxis]
|
||||||
if sp[:framestyle] in (:zerolines, :grid)
|
if sp[:framestyle] in (:zerolines, :grid)
|
||||||
gr_set_line(1, :solid, yaxis[:foreground_color_grid])
|
gr_set_line(1, :solid, yaxis[:foreground_color_tick])
|
||||||
gr_set_transparency(yaxis[:gridalpha])
|
gr_set_transparency(yaxis[:gridalpha])
|
||||||
else
|
else
|
||||||
gr_set_line(1, :solid, yaxis[:foreground_color_axis])
|
gr_set_line(1, :solid, yaxis[:foreground_color_tick])
|
||||||
end
|
end
|
||||||
GR.setclip(0)
|
GR.setclip(0)
|
||||||
gr_polyline(coords(ytick_segs)...)
|
gr_polyline(coords(ytick_segs)...)
|
||||||
end
|
end
|
||||||
GR.setclip(1)
|
GR.setclip(1)
|
||||||
|
|
||||||
|
# axis minor ticks
|
||||||
|
if xaxis[:showaxis]
|
||||||
|
if sp[:framestyle] in (:zerolines, :grid)
|
||||||
|
gr_set_line(1, :solid, xaxis[:foreground_color_minortick])
|
||||||
|
gr_set_transparency(xaxis[:minorgridalpha])
|
||||||
|
else
|
||||||
|
gr_set_line(1, :solid, xaxis[:foreground_color_minortick])
|
||||||
|
end
|
||||||
|
GR.setclip(0)
|
||||||
|
gr_polyline(coords(xminortick_segs)...)
|
||||||
|
end
|
||||||
|
if yaxis[:showaxis]
|
||||||
|
if sp[:framestyle] in (:zerolines, :grid)
|
||||||
|
gr_set_line(1, :solid, yaxis[:foreground_color_minortick])
|
||||||
|
gr_set_transparency(yaxis[:minorgridalpha])
|
||||||
|
else
|
||||||
|
gr_set_line(1, :solid, yaxis[:foreground_color_minortick])
|
||||||
|
end
|
||||||
|
GR.setclip(0)
|
||||||
|
gr_polyline(coords(yminortick_segs)...)
|
||||||
|
end
|
||||||
|
GR.setclip(1)
|
||||||
|
|
||||||
# tick marks
|
# tick marks
|
||||||
if !(xticks in (:none, nothing, false)) && xaxis[:showaxis]
|
if !(xticks in (:none, nothing, false)) && xaxis[:showaxis]
|
||||||
# x labels
|
# x labels
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user