legend Guide Type (GPL)
Syntax
legend(aesthetic(aesthetic.<aesthetic type>), <function>)
<aesthetic type>. An aesthetic associated with the
legend. The aesthetic identifies the legend, which was created as
the result of an aesthetic function in the ELEMENT
statement.
<function>. One or more valid functions. Use the null()
function
to hide the legend.
Description
Specifies properties of the legend associated with a specific aesthetic,
which is defined by an aesthetic function in the ELEMENT
statement.
The legend provides a visual representation of the scale created by
the aesthetic function. Thus, a legend guide is related to the aesthetic
scale in the same way an axis guide is related to a dimension scale.
Note that using a uniform aesthetic value in the aesthetic function
(for example, color(color.blue)
) does not create
a scale. Therefore, the legend is not used in that case.
Examples
GUIDE: legend(aesthetic(aesthetic.color), label("Gender"))
ELEMENT: interval(position(summary.count(jobcat)), color(gender))