Compare commits

...

1 Commits

Author SHA1 Message Date
Thomas Breloff
2e0d02552f started fonts 2017-01-09 11:42:53 -05:00
2 changed files with 23 additions and 3 deletions

View File

@ -259,6 +259,15 @@ const _subplot_defaults = KW(
:bottom_margin => :match,
:subplot_index => -1,
:colorbar_title => "",
:fontfamily => "Helvetica",
:fontsize => 10,
:fontcolor => :match, # matches foreground_color
:titlefontfamily => :match,
:titlefontsize => :match,
:titlefontcolor => :match,
:legendfontfamily => :match,
:legendfontsize => :match,
:legendfontcolor => :match,
)
const _axis_defaults = KW(
@ -278,6 +287,12 @@ const _axis_defaults = KW(
:discrete_values => [],
:formatter => :auto,
:mirror => false,
:tickfontfamily => :match,
:tickfontsize => :match,
:tickfontcolor => :match,
:guidefontfamily => :match,
:guidefontsize => :match,
:guidefontcolor => :match,
)
const _suppress_warnings = Set{Symbol}([
@ -942,8 +957,13 @@ const _match_map2 = KW(
:foreground_color_border => :foreground_color_subplot,
:foreground_color_guide => :foreground_color_subplot,
:foreground_color_text => :foreground_color_subplot,
:fontcolor => :foreground_color_subplot,
)
for prefix in (:title,:legend,:guide,:tick), postfix in (:family,:size,:color)
_match_map2[Symbol(prefix,:font,postfix)] = Symbol(:font,postfix)
end
# properly retrieve from plt.attr, passing `:match` to the correct key
function Base.getindex(plt::Plot, k::Symbol)
v = plt.attr[k]

View File

@ -48,8 +48,8 @@ _series_updated(plt::Plot, series::Series) = nothing
_before_layout_calcs(plt::Plot) = nothing
title_padding(sp::Subplot) = sp[:title] == "" ? 0mm : sp[:titlefont].pointsize * pt
guide_padding(axis::Axis) = axis[:guide] == "" ? 0mm : axis[:guidefont].pointsize * pt
title_padding(sp::Subplot) = sp[:title] == "" ? 0mm : sp[:titlefontsize] * pt
guide_padding(axis::Axis) = axis[:guide] == "" ? 0mm : axis[:guidefontsize] * pt
"Returns the (width,height) of a text label."
function text_size(lablen::Int, sz::Number, rot::Number = 0)
@ -90,7 +90,7 @@ function tick_padding(axis::Axis)
# hgt
# get the height of the rotated label
text_size(longest_label, axis[:tickfont].pointsize, rot)[2]
text_size(longest_label, axis[:tickfontsize], rot)[2]
end
end