Tailoring legends
The Plots
package shows, by default, a legend with a label for each series. This section will discuss how we have to tailor those legends to match our needs. As we saw in Chapter 10, The Anatomy of a Plot, legends are part of Plots’ subplots. Therefore, as discussed in this chapter’s Exploring plot attributes section, we can look for the related attributes in plotattr(:Subplot)
. All those attributes have the legend
prefix. Note that the legend attribute names use underscores to separate the words, but all offer aliases without underscores. For example, the legend_font_color
attribute has the legendfontcolor
alias.
As we previously explored in this chapter’s Formatting the fonts section, we can determine the font used for legend labels and titles using attributes. Those attributes have the following prefixes: legendfont
or legend_font
and legendtitlefont
or legend_title_font
. For example, we can use legend_font_color
and legend_title_font_color...