Create a Plot Matrix of Scatterplots in R Programming - pairs() Function Last Updated : 10 Dec, 2021 Comments Improve Suggest changes Like Article Like Report pairs() function in R language is used to return a plot matrix, consisting of scatter plots corresponding to each data frame. R - Create Plot Matrix of Scatterplots Syntax: pairs(data) Parameters: data: It is defined as value of pairs Plot. Returns: Color, Labels, Panels, and by Group in pairs plot. Create Plot Matrix of Scatterplots in RExample 1: Basic example of R - pairs() Function R # Set seed for reproducibility set.seed(425340) # Sample size of 800 N <- 800 # Create variable x1 <- rnorm(N) # Create correlated variable x2 <- x1 + rnorm(N, 0, 4) # Create another correlated variable x3 <- 2 * x1 - x2 + rnorm(N, 0, 3) data <- data.frame(x1, x2, x3) pairs(data) Output: Here, in the above example, the diagonal shows the names of the three numeric variables. The middle graphic in the first-row shows the relation between x1 and x2 whereas the right graph in the first row shows the relation between x1 and x3 and so on. Example 2: Another example to select Variables of pairs Plot R # Set seed for reproducibility set.seed(425340) # Sample size of 800 N <- 800 # Create variable x1 <- rnorm(N) # Create correlated variable x2 <- x1 + rnorm(N, 0, 4) # Create another correlated variable x3 <- 2 * x1 - x2 + rnorm(N, 0, 3) data <- data.frame(x1, x2, x3) pairs(~ x1 + x3, data = data) Output: Example 3: Another example with implementation to Modify Color, Shape of Points, Labels and Title R # Set seed for reproducibility set.seed(425340) # Sample size of 800 N <- 800 # Create variable x1 <- rnorm(N) # Create correlated variable x2 <- x1 + rnorm(N, 0, 4) # Create another correlated variable x3 <- 2 * x1 - x2 + rnorm(N, 0, 3) data <- data.frame(x1, x2, x3) pairs(~ x1 + x2 + x3, data = data) pairs(~ x1 + x3, data = data) pairs(data[, 1:3], col = "darkgreen", # Change color pch = 18, # Change shape of points # Change labels of diagonal labels = c("var1", "var2", "var3"), main = " pairs plot in R") Output: Comment More infoAdvertise with us Next Article Create a Plot Matrix of Scatterplots in R Programming - pairs() Function K kaurbal1698 Follow Improve Article Tags : R Language R Plot-Function Similar Reads Create a Matrix of Scatterplots (pairs() Equivalent) in ggplot2 Visualizing relationships between multiple variables simultaneously can be challenging. In base R, the pairs() function is often used to create a matrix of scatterplots, showing pairwise relationships between all columns in a data frame. However, for those who prefer the flexibility and aesthetics o 3 min read Addition of more points to a Plot in R Programming - points() Function points() function in R Language is used to add a group of points of specified shapes, size and color to an existing plot. Syntax: points(x, y, cex, pch, col) Parameters: x, y: Vector of coordinates cex: size of points pch: shape of points col: color of points Sample Scatter Plot: Python3 1== # R pro 2 min read Addition of Lines to a Plot in R Programming - lines() Function In R, the lines() function is called to add on top of already existing plot. This is particularly helpful when you want to add more lines, such as trend lines, regression lines, or special lines, on a plot. The lines() function allows flexibility in line color, line width, and line type, with multip 3 min read Create a Heatmap in R Programming - heatmap() Function A heatmap() function in R Programming Language is used to plot a heatmap. A heatmap is defined as a graphical representation of data using colors to visualize the value of the matrix. In this to represent more common values or higher activities brighter colors reddish colors are used and to less com 3 min read Plotting of Data using Generic plots in R Programming - plot() Function In this article, we will discuss how we plot data using Generic plots in R Programming Language using plot() Function. plot functionplot() function in R Programming Language is defined as a generic function for plotting. It can be used to create basic graphs of a different type. Syntax: plot(x, y, t 5 min read How to create a reusable plot_ly function in R In data visualization, reusability and consistency are crucial for maintaining clarity and efficiency. Plotly is the powerful library in the R for creating interactive plots. By encapsulating the plotting logic into the reusable functions. We can streamline the plotting process and it can ensure uni 5 min read How to create a scatter plot using lattice package in R? In this article, we will discuss how to create the scatter plots using lattice package in R programming language. In R programming, the Lattice package is a data visualization library that consists of various functions to plot different kinds of plots. Using the lattice library we can able to plot v 2 min read How to Create and Interpret Pairs Plots in R? In this article, we will discuss how to create and interpret Pair Plots in the R Language. The Pair Plot helps us to visualize the distribution of single variables as well as relationships between two variables. They are a great method to identify trends between variables for follow-up analysis. Pai 4 min read Create Dot Charts in R Programming - dotchart () Function dotchart() function in R Language is used to create a dot chart of the specified data. A dot chart is defined as a plot which is used to draw a Cleveland dot plot. Syntax: dotchart(x, labels = NULL, groups = NULL, gcolor = par("fg"), color = par("fg")) Parameters: x: it is defined as numeric vector 2 min read Control the Size of the Points in a Scatterplot in R In this article, we are going to see how to control the size of the points in a scatterplot in R Programming language. We will Control the size of the points in a scatterplot using cex argument of the plot function. In this approach to control the size of the points in a scatterplot, the user needs 2 min read Like