Minorgrid and minorticks for pyplot (#2621)

* Minor grids for pyplot

* Minorgrid and minorticks setup for pyplot
This commit is contained in:
isentropic 2020-04-25 00:15:00 +09:00 committed by GitHub
parent 64f7dc1aed
commit 09de2ebc0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1134,6 +1134,35 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
else else
pyaxis."grid"(false) pyaxis."grid"(false)
end end
#
if axis[:minorticks] > 1
pyaxis."set_minor_locator"(PyPlot.matplotlib.ticker.AutoMinorLocator(axis[:minorticks]))
pyaxis."set_tick_params"(
which = "minor",
direction = axis[:tick_direction] == :out ? "out" : "in",
width=py_thickness_scale(plt, intensity))
end
if axis[:minorgrid]
if !(axis[:minorticks] > 1) # Check if ticks were already configured
ax."minorticks_on"()
end
pyaxis."set_tick_params"(
which = "minor",
direction = axis[:tick_direction] == :out ? "out" : "in",
width=py_thickness_scale(plt, intensity))
pyaxis."grid"(true,
which = "minor",
color = fgcolor,
linestyle = py_linestyle(:line, axis[:minorgridstyle]),
linewidth = py_thickness_scale(plt, axis[:minorgridlinewidth]),
alpha = axis[:minorgridalpha])
end
py_set_axis_colors(sp, ax, axis) py_set_axis_colors(sp, ax, axis)
end end