From 1e6ffa64e9d7d35e1ee22448fe7ef9c578595362 Mon Sep 17 00:00:00 2001 From: Zhanibek Date: Thu, 11 Mar 2021 16:55:57 +0900 Subject: [PATCH] minimal working version --- src/backends/pyplot.jl | 7 +++++++ src/colorbars.jl | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 21243ca2..ff7616fd 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -978,14 +978,21 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) cb."formatter".set_powerlimits((-Inf, Inf)) cb."update_ticks"() + env = "\\mathregular" # matches the outer fonts https://matplotlib.org/tutorials/text/mathtext.html + ticks = get_colorbar_ticks(sp) + if sp[:colorbar] in (:top, :bottom) axis = sp[:xaxis] # colorbar inherits from x axis cbar_axis = cb."ax"."xaxis" + ticks_letter=:x else axis = sp[:yaxis] # colorbar inherits from y axis cbar_axis = cb."ax"."yaxis" + ticks_letter=:y end + 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[:tickfontsize])) lab."set_family"(axis[:tickfontfamily]) diff --git a/src/colorbars.jl b/src/colorbars.jl index 14e839ed..a16153b5 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -130,7 +130,7 @@ function optimal_colorbar_ticks_and_labels(sp::Subplot, ticks = nothing) unscaled_ticks = map(RecipesPipeline.inverse_scale_func(scale), scaled_ticks) labels = if any(isfinite, unscaled_ticks) - formatter = ap[:colorbar_formatter] + formatter = sp[:colorbar_formatter] if formatter in (:auto, :plain, :scientific, :engineering) map(labelfunc(scale, backend()), Showoff.showoff(scaled_ticks, formatter)) elseif formatter == :latex @@ -205,5 +205,5 @@ _transform_ticks(ticks::AbstractArray{T}) where T <: Dates.TimeType = Dates.valu _transform_ticks(ticks::NTuple{2, Any}) = (_transform_ticks(ticks[1]), ticks[2]) function _update_subplot_colorbars(sp::Subplot) - + # Dynamic callback from the pipeline if needed end