It's common to use the caption to provide information about the data source. ggplot() has functions geom_text(), geom_label() and annotate() for this purpose. In this case it is possible to position the legend inside the plotting area. x and y are the coordinates of the legend box.

They can be used by themselves as scatterplots or in cobination with other geoms, for example, for labeling points or for annotating the height of bars. Note that, the argument legend.position can be also a numeric vector c(x,y). In this post we discuss how ggplot2 controls positioning of text.. First we need to specify (x, y) coordinate in the plot where the text is placed. This can be done easily using the R function labs() or the functions xlab() and ylab(). Conceptually, an annotation supplies metadata for the plot: that is, it provides additional information about the data being displayed. Always ensure the axis and legend labels display the full variable name. position: Position adjustment, either as a string, or the result of a call to a position adjustment function. Text geoms are useful for labeling plots. By default, set to 90% of the resolution of the data. This R graphics tutorial shows how to customize a ggplot legend.. you will learn how to: Change the legend title and text labels; Modify the legend position.In the default setting of ggplot2, the legend is placed on the right of the plot. A common task in plotting is adding texts as labels or annotations to specific locations. They can be used by themselves as scatterplots or in cobination with other geoms, for example, for labeling points or for annotating the height of bars. The allowed values for the arguments legend.position are : “left”,“top”, “right”, “bottom”. geom_text() adds only text to the plot. tag can be used for adding identification tags to differentiate between multiple plots. Use the plot title and subtitle to explain the main findings.

na.rm: If FALSE, the default, missing values are removed with a warning. 8.2 Labels. This article describes how to change ggplot axis labels (or axis title). width: Bar width. When constructing a data visualisation, it is often necessary to make annotations to the data displayed. From a practical standpoint, however, metadata is just another form of data. show.legend: logical. geom_label() draws a rectangle behind the text, making it easier to read. If TRUE, missing values are silently removed. geom_label() draws a rectangle behind the text, making it easier to read. Text geoms are useful for labeling plots. Good labels are critical for making your plots accessible to a wider audience. geom_text() adds only text to the plot.