diff --git a/src/arg_desc.jl b/src/arg_desc.jl index 45dcaaa5a..167ac2854 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -124,6 +124,8 @@ const _arg_desc = KW( :tickfontvalign => "Symbol. Font vertical alignment of tick labels: :vcenter, :top, :bottom or :center", :tickfontrotation => "Real. Font rotation 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.", :guidefontsize => "Integer. Font pointsize of axes guides.", :guidefonthalign => "Symbol. Font horizontal alignment of axes guides: :hcenter, :left, :right or :center", diff --git a/src/args.jl b/src/args.jl index 1065f12e3..910082951 100644 --- a/src/args.jl +++ b/src/args.jl @@ -363,6 +363,8 @@ const _axis_defaults = KW( :tickfontvalign => :vcenter, :tickfontrotation => 0.0, :tickfontcolor => :match, + :foreground_color_tick => :match, + :foreground_color_minortick => :match, :guidefontfamily => :match, :guidefontsize => 11, :guidefonthalign => :hcenter, @@ -1283,6 +1285,8 @@ const _match_map2 = KW( :fontfamily_subplot => :fontfamily, :tickfontfamily => :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 @@ -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_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 end diff --git a/src/axes.jl b/src/axes.jl index 6f00a27a9..3638894d3 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -598,6 +598,8 @@ function axis_drawing_info(sp::Subplot) ytick_segs = Segments(2) xgrid_segs = Segments(2) ygrid_segs = Segments(2) + xminortick_segs = Segments(2) + yminortick_segs = Segments(2) xminorgrid_segs = Segments(2) yminorgrid_segs = Segments(2) xborder_segs = Segments(2) @@ -657,7 +659,7 @@ function axis_drawing_info(sp::Subplot) else xor(xaxis[:mirror], yaxis[:flip]) ? (ymax, t2) : (ymin, t1) end - push!(xtick_segs, (xminortick, tick_start), (xminortick, tick_stop)) # bottom tick + push!(xminortick_segs, (xminortick, tick_start), (xminortick, tick_stop)) # bottom tick end # sp[:draw_axes_border] && push!(xaxis_segs, (xtick, ymax), (xtick, t2)) # top tick xaxis[:minorgrid] && push!(xminorgrid_segs, (xminortick, ymin), (xminortick, ymax)) # vertical grid @@ -718,7 +720,7 @@ function axis_drawing_info(sp::Subplot) else xor(yaxis[:mirror], xaxis[:flip]) ? (xmax, t2) : (xmin, t1) end - push!(ytick_segs, (tick_start, ytick), (tick_stop, ytick)) # left tick + push!(yminortick_segs, (tick_start, ytick), (tick_stop, ytick)) # left tick end # sp[:draw_axes_border] && push!(yaxis_segs, (xmax, ytick), (t2, ytick)) # right tick yaxis[:minorgrid] && push!(yminorgrid_segs, (xmin, ytick), (xmax, ytick)) # horizontal grid @@ -726,5 +728,5 @@ function axis_drawing_info(sp::Subplot) 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 diff --git a/src/backends.jl b/src/backends.jl index 00ac483a3..d114c077e 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -355,9 +355,11 @@ const _gr_attr = merge_with_base_supported([ :legendfontrotation, :legendfontcolor, :tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign, :tickfontrotation, :tickfontcolor, + :foreground_color_tick, :foreground_color_minortick, :guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign, :guidefontrotation, :guidefontcolor, :grid, :gridalpha, :gridstyle, :gridlinewidth, + :minorgridalpha, :minorgridlinewidth, :legend, :legendtitle, :colorbar, :colorbar_title, :fill_z, :line_z, :marker_z, :levels, :ribbon, :quiver, diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 1ae84aabe..966f36c79 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -764,7 +764,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) GR.setwindow(xmin, xmax, ymin, ymax) 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 # draw the grid lines @@ -810,26 +810,49 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) # axis ticks if xaxis[:showaxis] 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]) else - gr_set_line(1, :solid, xaxis[:foreground_color_axis]) + gr_set_line(1, :solid, xaxis[:foreground_color_tick]) end GR.setclip(0) gr_polyline(coords(xtick_segs)...) end if yaxis[:showaxis] 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]) else - gr_set_line(1, :solid, yaxis[:foreground_color_axis]) + gr_set_line(1, :solid, yaxis[:foreground_color_tick]) end GR.setclip(0) gr_polyline(coords(ytick_segs)...) end 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 if !(xticks in (:none, nothing, false)) && xaxis[:showaxis] # x labels