Control Size of ggplot2 Legend Items in R Last Updated : 30 May, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will see how to control the size of ggplot2 Legend Items in R Programming Language. To create an R plot, we use ggplot() function and for making a scatter plot geom_point() function is added to ggplot() function. Let us first create a regular plot without any modifications so that the difference is apparent. Example: R # Load Package library("ggplot2") # Create a DataFrame data <- data.frame(Xdata = rnorm(10), Ydata = rnorm(10), LegendData = c("ld-01", "ld-02", "ld-03", "ld-04", "ld-05", "ld-06", "ld-07", "ld-08", "ld-09", "ld-10")) # Create a Scatter Plot ggplot(data, aes(Xdata, Ydata, color = LegendData)) + geom_point() Output: Scatter Plot with Legend To change the Size of Legend, we have to add guides() and guide_legend() functions to the geom_point() function. Inside guides() function, we take parameter color, which calls guide_legend() guide function as value. Inside guide_legend() function, we take an argument called override.aes, which has the list specifying aesthetic parameters of legend keys. Inside this list, we specify the size of legend. Syntax : guides(...) Parameter : ... : either a string or call to a guide function. here we call guide_legend() guide function. Return : each scale can be set scale-by-scale Syntax : guide_legend(override.aes = list()) Parameter : override.aes : A list specifying aesthetic parameters of legend key. Inside this list, we specify the size of legend to size object. Return : Legend Guides for various scales Example: R # Load Package library("ggplot2") # Create a DataFrame data <- data.frame(Xdata = rnorm(10), Ydata = rnorm(10), LegendData = c("ld-01", "ld-02", "ld-03", "ld-04", "ld-05", "ld-06", "ld-07", "ld-08", "ld-09", "ld-10")) # Create a Scatter Plot and change # the size of legend ggplot(data, aes(Xdata, Ydata, color = LegendData)) + geom_point()+ guides(color = guide_legend(override.aes = list(size = 10))) Output: Scatterplot with change size of legend Comment More infoAdvertise with us Next Article Control Size of ggplot2 Legend Items in R E erkrutikpatel Follow Improve Article Tags : R Language R-ggplot Similar Reads Control Line Color and Type in ggplot2 Plot Legend in R In this article, we will see how to control line color and type in ggplot2 plot legend in the R programming language. Using Default Parameters In this method, inbuilt attributes are passed to the function with appropriate values to generate the requirement. Thus, in order to change the color, col or 2 min read Set Legend Alpha of ggplot2 Plot in R In this article, we are going to see how to set the legend alpha of the ggplot2 Plot in R Programming Language. Setting the legend alpha of the plot using the alpha argument of the guide_legend function from the ggplot2 package. Syntax: guide_legend(override.aes = list(alpha)) Parameters: override.a 2 min read Create Legend in ggplot2 Plot in R In this article, we will discuss how to create a legend in ggplot using R programming language. To draw a legend within ggplot the parameter col is used, it basically adds colors to the plot and these colors are used to differentiate between different plots. To depict what each color represents a le 2 min read Remove Legend in ggplot2 in R In ggplot2 library in R, the legend is a key component that provides information about the mapping between aesthetics and data variables in a plot. The legend is automatically generated based on the aesthetic mappings specified in the aes() function. We can also remove the legend based on our requir 4 min read Reduce size of legend area using ggplot in R In this article, we will are going to see how to change the size of the legend in the plot in the R programming language. We will change legend size of the plot using cex argument of legend() function. In this approach to change the legend size of the plot, the user needs to use the cex argument of 2 min read Like