- Related Questions & Answers
- How to create a plot in R with a different plot window size using plot function?
- How to create gridlines that matches with Y-axis values in the plot created by using plot function in R?
- How to create a line chart in R using plot function with larger width?
- How to create a horizontal bar plot using barplot function in R?
- How to plot a function with ggplot2 in R?
- How to plot a function in R?
- Add minor gridlines to Matplotlib plot using Seaborn
- How to create a bar plot with ggplot2 using stat_summary in R?
- How to create a dot plot using ggplot2 in R?
- How to create a plot using rgb colors in R?
- How to create a plot with cross sign in R?
- How to create stacked plot with density using ggplot2 in R?
- How to create a staircase plot in R?
- How to create the stacked bar plot using ggplot2 in R with labels on the plot?
- How to create a plot title with unicode characters using ggplot2 in R?

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

Any plot created by using plot function does not display the plot with gridlines. On the other hand, if we create a plot using ggplot2 package then the plot has gridlines. Therefore, if we want to have gridlines on our plot then either we should create the plot using ggplot2 package or we can use the command grid() to add the gridlines on the plot created by plot function.

Creating a histogram using plot function −

> hist(rnorm(100))

Adding the grid lines to the above plot −

> grid()

Advertisements