Skip to contents

Position Helpers

Control legend placement

legend_left()
Place Legend on the Left with Proper Alignment
legend_right()
Place Legend on the Right with Proper Alignment
legend_top()
Place Legend on Top with Horizontal Layout
legend_bottom()
Place Legend on Bottom with Horizontal Layout
legend_inside()
Place Legend Inside the Plot Area
legend_none()
Remove Legend from Plot

Direction Helpers

Control legend orientation

legend_horizontal()
Set Legend Direction to Horizontal
legend_vertical()
Set Legend Direction to Vertical

Style Helpers

Customize legend appearance

legend_style()
Style Legend Appearance
legend_wrap()
Wrap Legend Entries into Columns or Rows
legend_reverse()
Reverse Legend Order
legend_order()
Reorder Legend Entries
legend_keys()
Customize Legend Key Appearance
legend_auto_fit()
Auto-fit Legend to Plot Height
center_legend_title()
Center Legend Title Over Keys
colorbar_style() colourbar_style()
Style Continuous Color Bar Legends

Multiple Legends

Control individual legends when a plot has multiple aesthetics

legend_hide()
Hide Specific Legends
legend_select()
Keep Only Specific Legends
legend_order_guides()
Control Legend Display Order
legend_merge()
Force Legends to Merge
legend_split()
Force Legends to Stay Separate

Multi-Panel Layouts

Collect and align legends across multi-panel plots (patchwork or cowplot)

collect_legends()
Collect Legends from Patchwork Compositions
collect_axes() align_guides_h()
Collect Axes from Patchwork Compositions
get_legend()
Extract Legend from a ggplot
shared_legend()
Combine Plots with a Shared Legend