commit
cadb0f96e2
@ -336,6 +336,12 @@ const _all_defaults = KW[
|
|||||||
_axis_defaults_byletter
|
_axis_defaults_byletter
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# to be able to reset font sizes to initial values
|
||||||
|
const _initial_fontsizes = Dict(:titlefont => _subplot_defaults[:titlefont].pointsize,
|
||||||
|
:legendfont => _subplot_defaults[:legendfont].pointsize,
|
||||||
|
:tickfont => _axis_defaults[:tickfont].pointsize,
|
||||||
|
:guidefont => _axis_defaults[:guidefont].pointsize)
|
||||||
|
|
||||||
const _all_args = sort(collect(union(map(keys, _all_defaults)...)))
|
const _all_args = sort(collect(union(map(keys, _all_defaults)...)))
|
||||||
|
|
||||||
RecipesBase.is_key_supported(k::Symbol) = is_attr_supported(k)
|
RecipesBase.is_key_supported(k::Symbol) = is_attr_supported(k)
|
||||||
@ -522,7 +528,6 @@ function default(d::KW, k::Symbol)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
# if arg is a valid color value, then set d[csym] and return true
|
# if arg is a valid color value, then set d[csym] and return true
|
||||||
|
|||||||
@ -297,12 +297,33 @@ function scalefontsize(k::Symbol, factor::Number)
|
|||||||
f.pointsize = round(Int, factor * f.pointsize)
|
f.pointsize = round(Int, factor * f.pointsize)
|
||||||
default(k, f)
|
default(k, f)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
scalefontsizes(factor::Number)
|
||||||
|
|
||||||
|
Scales all **current** font sizes by `factor`. For example `scalefontsizes(1.1)` increases all current font sizes by 10%. To reset to initial sizes, use `scalefontsizes()`
|
||||||
|
"""
|
||||||
function scalefontsizes(factor::Number)
|
function scalefontsizes(factor::Number)
|
||||||
for k in (:titlefont, :guidefont, :tickfont, :legendfont)
|
for k in (:titlefont, :guidefont, :tickfont, :legendfont)
|
||||||
scalefontsize(k, factor)
|
scalefontsize(k, factor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
scalefontsizes()
|
||||||
|
|
||||||
|
Resets font sizes to initial default values.
|
||||||
|
"""
|
||||||
|
function scalefontsizes()
|
||||||
|
for k in (:titlefont, :guidefont, :tickfont, :legendfont)
|
||||||
|
f = default(k)
|
||||||
|
if k in keys(_initial_fontsizes)
|
||||||
|
factor = f.pointsize / _initial_fontsizes[k]
|
||||||
|
scalefontsize(k, 1.0/factor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
"Wrap a string with font info"
|
"Wrap a string with font info"
|
||||||
immutable PlotText
|
immutable PlotText
|
||||||
str::AbstractString
|
str::AbstractString
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user