Use of Type H in Base R for Plotting a Graph



The type = "h" is a graphing argument in base R which is generally used inside a plot function. It helps to generate the vertical lines in the R environment instead of points. For example, if we want to plot values from 1 to 10 then type = "h" will plot the vertical lines starting from X-axis and the upper end of the lines will represent the actual value.

Example1

Live Demo

> plot(1:10,type="h")

Output:

Example2

Live Demo

> plot(rnorm(10),type="h")

Output:

Updated on: 2020-11-06T11:40:18+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements