** plot() **function is defined as as generic function for plotting in R Language. It can be used to create basic graphs of different type .

Syntax:

plot(x, y, type)

Parameters:

x and y:coordinates of points to plot

type:the type of graph to create

Returns:different type of plots

**Example 1:**

`# R program to plot a graph ` ` ` `# Values for x and y axis ` `x <- 1:5; y = x * x ` ` ` `# Using plot() function ` `plot` `(x, y, type = ` `"l"` `) ` `plot` `(x, y, type = ` `"h"` `) ` |

*chevron_right*

*filter_none*

In above example type=“l” stands for lines graph, type=“h” stands for ‘histogram’ like vertical lines.

**Example 2:**

`# R program to plot a graph ` ` ` `# Creating x and y-values ` `x - 1:5; y = x * x ` ` ` `# Using plot function ` `plot` `(x, y, type = ` `"b"` `) ` `plot` `(x, y, type = ` `"s"` `) ` `plot` `(x, y, type = ` `"p"` `) ` |

*chevron_right*

*filter_none*

Here, in above example type=“b” stands for both that means points are connected by a line

type=“s”indicates stair steps

type=“p” for points (by default).

## Recommended Posts:

- Set Aspect Ratio of Scatter Plot and Bar Plot in R Programming - Using asp in plot() Function
- Creating 3D Plots in R Programming - persp() Function
- Adding Text to Plots in R programming - text() and mtext () Function
- Plotting Graphs using Two Dimensional List in R Programming
- Add Color Between Two Points of Kernel Density Plot in R Programming - Using with() Function
- Graph Plotting in R Programming
- Addition of more points to a Plot in R Programming - points() Function
- Addition of Lines to a Plot in R Programming - lines() Function
- Plot Arrows Between Points in a Graph in R Programming - arrows() Function
- Plot a Geometric Distribution Graph in R Programming - dgeom() Function
- Draw a Quantile-Quantile Plot in R Programming - qqline() Function
- Create a Plot Matrix of Scatterplots in R Programming - pairs() Function
- Adding axis to a Plot in R programming - axis () Function
- Adding Straight Lines to a Plot in R Programming - abline() Function
- Scatter plots in R Language
- R - Stem and Leaf Plots
- Convert an Object to Data Frame in R Programming - as.data.frame() Function
- Check if the Object is a Data Frame in R Programming - is.data.frame() Function
- Convert a Data Frame into a Numeric Matrix in R Programming - data.matrix() Function
- Modify Data of a Data Frame with an Expression in R Programming - with() Function

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.