Example of plot library(ggplot2) p <- ggplot(ToothGrowth, aes(x=dose, y=len, fill=dose)) + geom_boxplot() p Change the legend position The position of the legend can be changed using the function theme() as follow : p + theme(legend.position="top") p +...
Control legend position withlegend.position You can place the legend literally anywhere. To put it around the chart, use thelegend.positionoption and specifytop,right,bottom, orleft. To put it inside the plot area, specify a vector of length 2, both values going between 0 and 1 and giving...
* this is not part of ggplot specs * Legend Options for each legend */ fun padding(): Double // Space around legend content (px) fun margins(): Thickness // Space between legends fun spacing(): DoubleVector fun position(): LegendPosition 25 changes: 20 additions & 5 deletions 25 .....
The following example shows how to align the plot title in layout.title. x sets the x position with respect to xref from "0" (left) to "1" (right), and y sets the y position with respect to yref from "0" (bottom) to "1" (top). Moreover, you can define xanchor to left,ri...