Remove grid and background from plot using ggplot2 in R Last Updated : 16 Apr, 2025 Comments Improve Suggest changes Like Article Like Report A plot by default is produced with a grid background and grayish colored background. In this article we will see, how a gird can be removed from a plot. We will use a line plot, for demonstration but the same can be employed for any other Visualization.To understand the difference better let us first create a plot with grid and background. R df <- data.frame(a=c(2,4,8), b=c(5, 10, 15)) plot = ggplot(df, aes(x = a, y = b)) + geom_point() + geom_line() #output plot Output:Basic Line PlotNow, We are going to perform some operation/ modification on this plot. Remove Grid:Assigning the grid's major and minor with the element_blanck() function, will remove the grid but not remove the background color and borderlines. R df <- data.frame(a=c(2,4,8),b=c(5, 10, 15)) plot + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) Output:Remove Grid But not remove BackgroundOnly Grid and Axis Line:Using theme_bw() function with the plot removes the grayish background but doesn't affect the Grid. R df <- data.frame(a=c(2,4,8),b=c(5, 10, 15)) # theme_bw() function plot + theme_bw() Output:Only Grid and AxisRemove Background and Grid:Assigning panel.background with element_blank() function will remove both grid and the background. R df <- data.frame(a=c(2,4,8),b=c(5, 10, 15)) plot + theme(panel.background = element_blank()) Output:Remove Grid and Background Comment More infoAdvertise with us Next Article Themes and background colors in ggplot2 in R I immortalishika2001 Follow Improve Article Tags : Technical Scripter R Language Technical Scripter 2020 R-ggplot Similar Reads Themes and background colors in ggplot2 in R In this article, we will discuss how to change the look of a plot theme (background color, panel background color, and gridlines) using the R Programming Language and ggplot2 package. Themes in ggplot2 package The ggplot2 package in R Language has 8 built-in themes. To use these themes we just need 3 min read Remove NA Values from ggplot2 Plot in R In this article, we are going to see how to remove the NA values from the ggplot2 plot in the R programming language. Using complete.cases() function complete.cases() function: This function will be returning a logical vector indicating which cases are complete, i.e., have no missing values. Syntax: 2 min read Plot from DataFrame in ggplot2 using R ggplot2 is a popular data visualization library in the R programming language. It is widely used for creating beautiful, customizable, and informative visualizations. One of the most useful features of ggplot2 is the ability to plot data stored in a data frame. In this article, we will learn how to 4 min read Plot from DataFrame in ggplot2 using R ggplot2 is a popular data visualization library in the R programming language. It is widely used for creating beautiful, customizable, and informative visualizations. One of the most useful features of ggplot2 is the ability to plot data stored in a data frame. In this article, we will learn how to 4 min read Plot from DataFrame in ggplot2 using R ggplot2 is a popular data visualization library in the R programming language. It is widely used for creating beautiful, customizable, and informative visualizations. One of the most useful features of ggplot2 is the ability to plot data stored in a data frame. In this article, we will learn how to 4 min read How to Remove Option Bar from ggplotly Using R In interactive visualizations created with the plotly package in R, a toolbar appears by default when the plot is rendered. This toolbar allows users to zoom, pan, save images, and reset the view. However, in certain cases, you may want to remove this toolbar (also known as the options bar) to provi 2 min read Like