renamed new legend setting from :label to :inline

This commit is contained in:
wfrgra 2020-03-31 19:38:47 +11:00
parent ae009cd53f
commit 2a4b74d0ff
3 changed files with 5 additions and 5 deletions

View File

@ -89,7 +89,7 @@ const _arg_desc = KW(
:foreground_color_legend => "Color Type or `:match` (matches `:foreground_color_subplot`). Foreground color of the legend.", :foreground_color_legend => "Color Type or `:match` (matches `:foreground_color_subplot`). Foreground color of the legend.",
:foreground_color_title => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of subplot title.", :foreground_color_title => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of subplot title.",
:color_palette => "Vector of colors (cycle through) or color gradient (generate list from gradient) or `:auto` (generate a color list using `Colors.distiguishable_colors` and custom seed colors chosen to contrast with the background). The color palette is a color list from which series colors are automatically chosen.", :color_palette => "Vector of colors (cycle through) or color gradient (generate list from gradient) or `:auto` (generate a color list using `Colors.distiguishable_colors` and custom seed colors chosen to contrast with the background). The color palette is a color list from which series colors are automatically chosen.",
:legend => "Bool (show the legend?) or Symbol (legend position). Symbol values: `:none`, `:best`, `:right`, `:left`, `:top`, `:bottom`, `:inside`, `:legend`, `:topright`, `:topleft`, `:bottomleft`, `:bottomright` (note: only some may be supported in each backend)", :legend => "Bool (show the legend?) or Symbol (legend position). Symbol values: `:none`, `:best`, `:right`, `:left`, `:top`, `:bottom`, `:inside`, `:legend`, `:topright`, `:topleft`, `:bottomleft`, `:bottomright` , `:inline` (note: only some may be supported in each backend)",
:legendfontfamily => "String or Symbol. Font family of legend entries.", :legendfontfamily => "String or Symbol. Font family of legend entries.",
:legendfontsize => "Integer. Font pointsize of legend entries.", :legendfontsize => "Integer. Font pointsize of legend entries.",
:legendfonthalign => "Symbol. Font horizontal alignment of legend entries: :hcenter, :left, :right or :center", :legendfonthalign => "Symbol. Font horizontal alignment of legend entries: :hcenter, :left, :right or :center",

View File

@ -1252,7 +1252,7 @@ function convertLegendValue(val::Symbol)
:best :best
elseif val in (:no, :none) elseif val in (:no, :none)
:none :none
elseif val in (:right, :left, :top, :bottom, :inside, :best, :legend, :topright, :topleft, :bottomleft, :bottomright, :outertopright, :outertopleft, :outertop, :outerright, :outerleft, :outerbottomright, :outerbottomleft, :outerbottom, :label) elseif val in (:right, :left, :top, :bottom, :inside, :best, :legend, :topright, :topleft, :bottomleft, :bottomright, :outertopright, :outertopleft, :outertop, :outerright, :outerleft, :outerbottomright, :outerbottomleft, :outerbottom, :inline)
val val
else else
error("Invalid symbol for legend: $val") error("Invalid symbol for legend: $val")

View File

@ -1043,7 +1043,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
viewport_plotarea[3] += legendh + 0.04 viewport_plotarea[3] += legendh + 0.04
end end
end end
if sp[:legend] == :label if sp[:legend] == :inline
viewport_plotarea[2] -= legendw viewport_plotarea[2] -= legendw
end end
@ -1801,7 +1801,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
gr_text(GR.wctondc(xi, yi)..., str) gr_text(GR.wctondc(xi, yi)..., str)
end end
if sp[:legend] == :label && should_add_to_legend(series) if sp[:legend] == :inline && should_add_to_legend(series)
gr_set_font(legendfont(sp)) gr_set_font(legendfont(sp))
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF) GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
gr_set_textcolor(plot_color(sp[:legendfontcolor])) gr_set_textcolor(plot_color(sp[:legendfontcolor]))
@ -1815,7 +1815,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
hascolorbar(sp) && gr_draw_colorbar(cbar, sp, get_clims(sp)) hascolorbar(sp) && gr_draw_colorbar(cbar, sp, get_clims(sp))
# add the legend # add the legend
if !(sp[:legend] in(:none, :label)) if !(sp[:legend] in(:none, :inline))
GR.savestate() GR.savestate()
GR.selntran(0) GR.selntran(0)
GR.setscale(0) GR.setscale(0)