Fixing the colorbar title for colorbars on the top. (#4191)

* To fix #4183.

* Providing my information according to #3503.
This commit is contained in:
zhiyuanzhai 2022-05-02 17:00:50 +08:00 committed by GitHub
parent e06143ce33
commit 137d339e0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -712,6 +712,10 @@
{ {
"name": "Steve Leung", "name": "Steve Leung",
"type": "Other" "type": "Other"
},
{
"name": "Xu Zhi-Yuan",
"type": "Other"
} }
], ],
"upload_type": "software" "upload_type": "software"

View File

@ -206,8 +206,8 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
if hascolorbar(sp) if hascolorbar(sp)
cticks = get_colorbar_ticks(sp)[2] cticks = get_colorbar_ticks(sp)[2]
colorbar_style = PGFPlotsX.Options("ylabel" => sp[:colorbar_title])
if sp[:colorbar] === :top if sp[:colorbar] === :top
colorbar_style = PGFPlotsX.Options("xlabel" => sp[:colorbar_title])
push!( push!(
colorbar_style, colorbar_style,
"at" => string((0.5, 1.05)), "at" => string((0.5, 1.05)),
@ -217,6 +217,7 @@ function (pgfx_plot::PGFPlotsXPlot)(plt::Plot{PGFPlotsXBackend})
"xticklabel style" => pgfx_get_colorbar_ticklabel_style(sp), "xticklabel style" => pgfx_get_colorbar_ticklabel_style(sp),
) )
else else
colorbar_style = PGFPlotsX.Options("ylabel" => sp[:colorbar_title])
push!( push!(
colorbar_style, colorbar_style,
"ytick" => string("{", join(cticks, ","), "}"), "ytick" => string("{", join(cticks, ","), "}"),