From 412fc43c611f70ce92654d564c4baeac9440a7fe Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Fri, 19 Mar 2021 12:25:52 +0900 Subject: [PATCH] working prototype --- src/args.jl | 12 +++++++----- src/backends/pyplot.jl | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/args.jl b/src/args.jl index 262a2a26..2452dfdf 100644 --- a/src/args.jl +++ b/src/args.jl @@ -383,6 +383,7 @@ const _subplot_defaults = KW( :legendtitle => nothing, :colorbar => :legend, :clims => :auto, + :colorbar_fontfamily => :match, :colorbar_ticks => :auto, :colorbar_tickfontfamily => :match, :colorbar_tickfontsize => 8, @@ -418,7 +419,6 @@ const _subplot_defaults = KW( :colorbar_title => "", :colorbar_titlefontsize => 10, :colorbar_title_location => :center, # also :left or :right - :colorbar_fontfamily => :match, :colorbar_titlefontfamily => :match, :colorbar_titlefonthalign => :hcenter, :colorbar_titlefontvalign => :vcenter, @@ -1340,10 +1340,10 @@ const _match_map = KW( :background_color_inside => :background_color_subplot, :foreground_color_legend => :foreground_color_subplot, :foreground_color_title => :foreground_color_subplot, - :left_margin => :margin, - :top_margin => :margin, - :right_margin => :margin, - :bottom_margin => :margin, + :left_margin => :margin, + :top_margin => :margin, + :right_margin => :margin, + :bottom_margin => :margin, :titlefontfamily => :fontfamily_subplot, :titlefontcolor => :foreground_color_subplot, :legendfontfamily => :fontfamily_subplot, @@ -1353,6 +1353,8 @@ const _match_map = KW( :colorbar_fontfamily => :fontfamily_subplot, :colorbar_titlefontfamily => :fontfamily_subplot, :colorbar_titlefontcolor => :foreground_color_subplot, + :colorbar_tickfontfamily => :fontfamily_subplot, + :colorbar_tickfontcolor => :foreground_color_subplot, :plot_titlefontfamily => :fontfamily, :plot_titlefontcolor => :foreground_color, :tickfontcolor => :foreground_color_text, diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 99fb0516..aca6bb64 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -978,7 +978,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) end - cb."set_label"(sp[:colorbar_title],size=py_thickness_scale(plt, sp[:yaxis][:guidefontsize]),family=sp[:yaxis][:guidefontfamily], color = py_color(sp[:yaxis][:guidefontcolor])) + cb."set_label"(sp[:colorbar_title],size=py_thickness_scale(plt, sp[:colorbar_titlefontsize]),family=sp[:colorbar_titlefontfamily], color = py_color(sp[:colorbar_titlefontcolor])) # cb."formatter".set_useOffset(false) # This for some reason does not work, must be a pyplot bug, instead this is a workaround: cb."formatter".set_powerlimits((-Inf, Inf)) @@ -1000,9 +1000,9 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) sp[:colorbar_ticks] == :native ? nothing : py_set_ticks(cb.ax, ticks, ticks_letter, env) for lab in cbar_axis."get_ticklabels"() - lab."set_fontsize"(py_thickness_scale(plt, axis[:colorbar_tickfontsize])) - lab."set_family"(axis[:colorbar_tickfontfamily]) - lab."set_color"(py_color(axis[:colorbar_tickfontcolor])) + lab."set_fontsize"(py_thickness_scale(plt, sp[:colorbar_tickfontsize])) + lab."set_family"(sp[:colorbar_tickfontfamily]) + lab."set_color"(py_color(sp[:colorbar_tickfontcolor])) end # Adjust thickness of the cbar ticks