> For the complete documentation index, see [llms.txt](https://ar-riyaz.gitbook.io/r-for-bioinformatics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ar-riyaz.gitbook.io/r-for-bioinformatics/data-visualization-in-r/r-base-graphics/generic-plot-types.md).

# Generic Plot Types

The `plot()` function in R is the function to create the most basic type of plots.

A simplified format of the function is:

```r
plot(x, y, type="p")
```

Here,

* **x and y**: the coordinates of points to plot
* **type**: the type of graph to create; Possible values are :
  * type=“p”: for **p**oints (by default)
  * type=“l”: for **l**ines
  * type=“b”: for **b**oth; points are connected by a line
  * type=“o”: for both ‘**o**verplotted’;
  * type=“h”: for ‘**h**istogram’ like vertical lines
  * type=“s”: for stair **s**teps
  * type=“n”: for no plotting

#### Example

```r
# Data
x<-1:10; y=x**3

# Create different plots
plot(x,y, type="p")
plot(x,y, type="b")
plot(x,y, type="h")
plot(x,y, type="s")
```

![](https://3681152927-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvUtrdiIkCrBX60yTgn1m%2Fuploads%2FtGedjRPNt4pNRByS5jzP%2Fimage.png?alt=media\&token=1f4581c9-ba96-4757-8282-a80de415d61c)![](https://3681152927-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvUtrdiIkCrBX60yTgn1m%2Fuploads%2F9mahgmSqo10LhQzWVKXV%2Fimage.png?alt=media\&token=a8a90f2a-7184-418a-ad61-38862ad9208e)![](https://3681152927-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvUtrdiIkCrBX60yTgn1m%2Fuploads%2FR7oUuFvoAjxuFONebQyZ%2Fimage.png?alt=media\&token=e7b8681c-5e3a-4ccb-83c0-61499ff732f4)![](https://3681152927-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvUtrdiIkCrBX60yTgn1m%2Fuploads%2FSvBfMjODuCOqei0ajrhB%2Fimage.png?alt=media\&token=2816e656-faf8-4557-9aea-2ca45d17251b)

#### Source:

Source of contents on this page: [Generic plot types in R](http://www.sthda.com/english/wiki/generic-plot-types-in-r-software)
