- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Usually, plots are created with solid lines but sometimes we need to use dashed line so that the points can represent a threshold or something critical, the main objective here is to get the attention of the reader on these points. In base R, the plots are created with plot function and we can use abline function with lty =2 to draw dashed lines.

x<−−5:5 x [1] −5 −4 −3 −2 −1 0 1 2 3 4 5 plot(x)

abline(h=2,lty=2)

y<−rnorm(10,1,5) plot(y)

abline(h=2,lty=2)

z<−sample(c(-10:10),10) z [1] −5 −8 4 0 8 −9 −10 6 −1 10 plot(z)

abline(h=2,lty=2)

- Related Questions & Answers
- How to create a line that passes through specified points in an R plot?
- How to create a plot with dashed regression line in base R?
- How to create horizontal line for Y variable at median in base R plot?
- How to create a dashed horizontal line in a ggplot2 graph in R?
- Check if a line passes through the origin in C++
- How to create a horizontal line in a histogram in base R?
- How to create a boxplot in base R without any axes except Y?
- How to create a plot with reversed Y-axis labels in base R?
- How to create a random vector in R that sums to 1?
- How to create bar plot in base R with different limits for Y-axis?
- How to create heatmap in base R?
- How to create a horizontal boxplot in base R?
- How to create a line for equal values of x and y in scatterplot in R?
- How to create vertical line for X variable at median in base R plot
- How to make dotted/dashed line in iOS?

Advertisements