implement titlefont legendfont tickfont and guidefont functions to construct font objects from subplots and axes

This commit is contained in:
Daniel Schwabeneder 2017-11-19 14:58:30 +01:00
parent 68a060b7eb
commit 8fee5e0de7
2 changed files with 41 additions and 1 deletions

View File

@ -764,7 +764,7 @@ function processGridArg!(d::KW, arg, letter)
end
end
processFontArgs!(d::KW, fontname::Symbol, args::Tuple)
function processFontArgs!(d::KW, fontname::Symbol, args::Tuple)
fnt = font(args...)
d[Symbol(fontname, :family)] = fnt.family
d[Symbol(fontname, :size)] = fnt.pointsize

View File

@ -1007,3 +1007,43 @@ xmax(plt::Plot) = ignorenan_maximum([ignorenan_maximum(series.d[:x]) for series
"Extrema of x-values in plot"
ignorenan_extrema(plt::Plot) = (xmin(plt), xmax(plt))
# ---------------------------------------------------------------
# get fonts from objects:
titlefont(sp::Subplot) = font(
sp[:titlefontfamily],
sp[:titlefontsize],
sp[:titlefont],
sp[:titlefonthalign],
sp[:titlefontrotation],
sp[:titlefontcolor],
)
legendfont(sp::Subplot) = font(
sp[:legendfontfamily],
sp[:legendfontsize],
sp[:legendfont],
sp[:legendfonthalign],
sp[:legendfontrotation],
sp[:legendfontcolor],
)
tickfont(ax::Axis) = font(
ax[:tickfontfamily],
ax[:tickfontsize],
ax[:tickfont],
ax[:tickfonthalign],
ax[:tickfontrotation],
ax[:tickfontcolor],
)
guidefont(ax::Axis) = font(
ax[:guidefontfamily],
ax[:guidefontsize],
ax[:guidefont],
ax[:guidefonthalign],
ax[:guidefontrotation],
ax[:guidefontcolor],
)