Remove NA Values from ggplot2 Plot in R Last Updated : 23 Aug, 2021 Comments Improve Suggest changes Like Article Like Report 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: complete.cases(…) Arguments: …: a sequence of vectors, matrices, and data frames. Create dataframe with NA values for demonstration: Python3 library("ggplot2") data <- data.frame(x = c(4,NA, 10,5, 1, NA, 2, 1, 6, 3), y = c(4, 2, NA, NA, 7, 2, 1, 8,NA,10)) data Output: Example 1: Removing NA values from plot In this example, we will be plotting a ggplot2 line plot of 10 data points and further with the help of the complete.cases() function we will be removing the NA value to plot the ggplot2 line plot in the R programming language. R library("ggplot2") data <- data.frame(x = c(4,NA, 10,5, 1, NA, 2, 1, 6, 3), y = c(4, 2, NA, NA, 7, 2, 1, 8,NA,10)) data_complete=data[complete.cases(data), ] ggplot(data_complete, aes(x, y)) +geom_line() Output: Example 2: Removing NA values from plot with a different dataset In this example, we will be plotting a ggplot2 plot of 5data points and further with the help of the complete.cases() function we will be removing the NA value to plot the ggplot2 plot in the R programming language. R library("ggplot2") data <- data.frame(x =c(7,9,NA,4,NA), y=c(10,3,8,5,6) ) data_complete = data[complete.cases(data), ] ggplot(data_complete, aes(x, y)) +geom_point() Output: Comment More infoAdvertise with us Next Article Remove NA Values from ggplot2 Plot in R G geetansh044 Follow Improve Article Tags : R Language R-ggplot Similar Reads Remove Labels from ggplot2 Facet Plot in R In this article, we will discuss how to remove the labels from the facet plot in ggplot2 in the R Programming language. Facet plots, where one subsets the data based on a categorical variable and makes a series of similar plots with the same scale. We can easily plot a facetted plot using the facet_ 2 min read Remove grid and background from plot using ggplot2 in R 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 firs 1 min read Remove Axis Values of Plot in Base R In this article, we will be looking at the approach to remove axis values of the plot using the base functions of the R programming language. In this approach to remove the axis values of the plot, the user just need to use the base function plot() of the R programming language, and further in this 2 min read Remove Axis Labels using ggplot2 in R In this article, we are going to see how to remove axis labels of the ggplot2 plot in the R programming language. We will use theme() function from ggplot2 package. In this approach to remove the ggplot2 plot labels, the user first has to import and load the ggplot2 package in the R console, which i 2 min read Remove Axis Labels and Ticks in ggplot2 Plot in R In this article, we will discuss how to remove axis labels and ticks in ggplot2 in R Programming Language. The axes labels and ticks can be removed in ggplot using the theme() method. This method is basically used to modify the non-data components of the made plot. It gives the plot a good graphical 2 min read Like