colorbar scale supported
This commit is contained in:
parent
2b6ccd9a68
commit
0ba32ade50
@ -807,31 +807,37 @@ function py_compute_axis_minval(sp::Subplot, axis::Axis)
|
|||||||
minval
|
minval
|
||||||
end
|
end
|
||||||
|
|
||||||
function py_set_scale(ax, sp::Subplot, axis::Axis)
|
function py_set_scale(ax, sp::Subplot, scale::Symbol, letter::Symbol)
|
||||||
scale = axis[:scale]
|
|
||||||
letter = axis[:letter]
|
|
||||||
scale in supported_scales() || return @warn("Unhandled scale value in pyplot: $scale")
|
scale in supported_scales() || return @warn("Unhandled scale value in pyplot: $scale")
|
||||||
func = getproperty(ax, Symbol("set_", letter, "scale"))
|
func = getproperty(ax, Symbol("set_", letter, "scale"))
|
||||||
if PyPlot.version ≥ v"3.3" # https://matplotlib.org/3.3.0/api/api_changes.html
|
if PyPlot.version ≥ v"3.3" # https://matplotlib.org/3.3.0/api/api_changes.html
|
||||||
letter = Symbol("")
|
pyletter = Symbol("")
|
||||||
|
else
|
||||||
|
pyletter = letter
|
||||||
end
|
end
|
||||||
kw = KW()
|
kw = KW()
|
||||||
arg = if scale == :identity
|
arg = if scale == :identity
|
||||||
"linear"
|
"linear"
|
||||||
else
|
else
|
||||||
kw[Symbol(:base,letter)] = if scale == :ln
|
kw[Symbol(:base, pyletter)] = if scale == :ln
|
||||||
ℯ
|
ℯ
|
||||||
elseif scale == :log2
|
elseif scale == :log2
|
||||||
2
|
2
|
||||||
elseif scale == :log10
|
elseif scale == :log10
|
||||||
10
|
10
|
||||||
end
|
end
|
||||||
kw[Symbol(:linthresh,letter)] = NaNMath.max(1e-16, py_compute_axis_minval(sp, axis))
|
axis = sp[Symbol(letter, :axis)]
|
||||||
|
kw[Symbol(:linthresh, pyletter)] = NaNMath.max(1e-16, py_compute_axis_minval(sp, axis))
|
||||||
"symlog"
|
"symlog"
|
||||||
end
|
end
|
||||||
func(arg; kw...)
|
func(arg; kw...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function py_set_scale(ax, sp::Subplot, axis::Axis)
|
||||||
|
scale = axis[:scale]
|
||||||
|
letter = axis[:letter]
|
||||||
|
py_set_scale(ax, sp, scale, letter)
|
||||||
|
end
|
||||||
|
|
||||||
function py_set_axis_colors(sp, ax, a::Axis)
|
function py_set_axis_colors(sp, ax, a::Axis)
|
||||||
for (loc, spine) in ax.spines
|
for (loc, spine) in ax.spines
|
||||||
@ -990,13 +996,13 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend})
|
|||||||
cbar_axis = cb."ax"."yaxis"
|
cbar_axis = cb."ax"."yaxis"
|
||||||
ticks_letter=:y
|
ticks_letter=:y
|
||||||
end
|
end
|
||||||
|
py_set_scale(cb.ax, sp, sp[:colorbar_scale], ticks_letter)
|
||||||
sp[:colorbar_ticks] == :native ? nothing : py_set_ticks(cb.ax, ticks, ticks_letter, env)
|
sp[:colorbar_ticks] == :native ? nothing : py_set_ticks(cb.ax, ticks, ticks_letter, env)
|
||||||
|
|
||||||
for lab in cbar_axis."get_ticklabels"()
|
for lab in cbar_axis."get_ticklabels"()
|
||||||
lab."set_fontsize"(py_thickness_scale(plt, axis[:tickfontsize]))
|
lab."set_fontsize"(py_thickness_scale(plt, axis[:colorbar_tickfontsize]))
|
||||||
lab."set_family"(axis[:tickfontfamily])
|
lab."set_family"(axis[:colorbar_tickfontfamily])
|
||||||
lab."set_color"(py_color(axis[:tickfontcolor]))
|
lab."set_color"(py_color(axis[:colorbar_tickfontcolor]))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Adjust thickness of the cbar ticks
|
# Adjust thickness of the cbar ticks
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user