From 3fdf87a9559eef4b56b074b00fb92a8f28bfd83d Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 26 Aug 2019 10:37:07 +0200 Subject: [PATCH] add legendtitlefont attributes --- src/arg_desc.jl | 9 ++++++++- src/args.jl | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/arg_desc.jl b/src/arg_desc.jl index 120d1c36..69c40cd1 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -50,7 +50,7 @@ const _arg_desc = KW( :primary => "Bool. Does this count as a 'real series'? For example, you could have a path (primary), and a scatter (secondary) as 2 separate series, maybe with different data (see sticks recipe for an example). The secondary series will get the same color, etc as the primary.", :hover => "nothing or vector of strings. Text to display when hovering over each data point.", :colorbar_entry => "Bool. Include this series in the color bar? Set to `false` to exclude.", - + # plot args :plot_title => "String. Title for the whole plot (not the subplots) (Note: Not currently implemented)", :background_color => "Color Type. Base color for all backgrounds.", @@ -95,9 +95,16 @@ const _arg_desc = KW( :legendfontvalign => "Symbol. Font vertical alignment of legend entries: :vcenter, :top, :bottom or :center", :legendfontrotation => "Real. Font rotation of legend entries", :legendfontcolor => "Color Type. Font color of legend entries", +:legendtitlefontfamily => "String or Symbol. Font family of the legend title.", +:legendtitlefontsize => "Integer. Font pointsize the legend title.", +:legendtitlefonthalign => "Symbol. Font horizontal alignment of the legend title: :hcenter, :left, :right or :center", +:legendtitlefontvalign => "Symbol. Font vertical alignment of the legend title: :vcenter, :top, :bottom or :center", +:legendtitlefontrotation => "Real. Font rotation of the legend title", +:legendtitlefontcolor => "Color Type. Font color of the legend title", :colorbar => "Bool (show the colorbar?) or Symbol (colorbar position). Symbol values: `:none`, `:best`, `:right`, `:left`, `:top`, `:bottom`, `:legend` (matches legend value) (note: only some may be supported in each backend)", :clims => "`:auto` or NTuple{2,Number}. Fixes the limits of the colorbar.", :legendfont => "Font. Font of legend items.", +:legendtitlefont => "Font. Font of the legend title.", :annotations => "(x,y,text) tuple(s). Can be a single tuple or a list of them. Text can be String or PlotText (created with `text(args...)`) Add one-off text annotations at the x,y coordinates.", :projection => "Symbol or String. '3d' or 'polar'", :aspect_ratio => "Symbol (:equal) or Number. Plot area is resized so that 1 y-unit is the same size as `aspect_ratio` x-units.", diff --git a/src/args.jl b/src/args.jl index 06bb27e7..68ac3fd4 100644 --- a/src/args.jl +++ b/src/args.jl @@ -336,6 +336,12 @@ const _subplot_defaults = KW( :legendfontvalign => :vcenter, :legendfontrotation => 0.0, :legendfontcolor => :match, + :legendtitlefontfamily => :match, + :legendtitlefontsize => 11, + :legendtitlefonthalign => :hcenter, + :legendtitlefontvalign => :vcenter, + :legendtitlefontrotation => 0.0, + :legendtitlefontcolor => :match, :annotations => [], # annotation tuples... list of (x,y,annotation) :projection => :none, # can also be :polar or :3d :aspect_ratio => :none, # choose from :none or :equal @@ -450,6 +456,7 @@ const _initial_axis_defaults = deepcopy(_axis_defaults) # to be able to reset font sizes to initial values const _initial_fontsizes = Dict(:titlefontsize => _subplot_defaults[:titlefontsize], :legendfontsize => _subplot_defaults[:legendfontsize], + :legendtitlefontsize => _subplot_defaults[:legendtitlefontsize], :tickfontsize => _axis_defaults[:tickfontsize], :guidefontsize => _axis_defaults[:guidefontsize]) @@ -961,7 +968,7 @@ function preprocessArgs!(plotattributes::KW) end end # fonts - for fontname in (:titlefont, :legendfont) + for fontname in (:titlefont, :legendfont, :legendtitlefont) args = pop!(plotattributes, fontname, ()) for arg in wraptuple(args) processFontArg!(plotattributes, fontname, arg) @@ -1271,8 +1278,10 @@ const _match_map = KW( :bottom_margin => :margin, :titlefontfamily => :fontfamily_subplot, :legendfontfamily => :fontfamily_subplot, + :legendtitlefontfamily => :fontfamily_subplot, :titlefontcolor => :foreground_color_subplot, :legendfontcolor => :foreground_color_subplot, + :legendtitlefontcolor => :foreground_color_subplot, :tickfontcolor => :foreground_color_text, :guidefontcolor => :foreground_color_guide, )