The above shows 2 legends, one where each item is placed in a new column and one where each item is placed in a new row.
How can I control for that?
CodePudding user response:
This is controlled by the nrow
and ncol
arguments to guide_legend()
.
You can call guide_legend()
either within guides()
:
plot
guides(color = guide_legend(nrow = 1))
…or within scale_*()
:
plot
scale_color_discrete(guide = guide_legend(nrow = 1))