- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a graph in R using ggplot2 with all the four quadrants?
The default graph created by using ggplot2 package shows the axes labels depending on the starting and ending values of the column of the data frame or vector but we might want to visualize it just like we do in paper form of graphs that shows all of the four quadrants. This can be done by using xlim, ylim, geom_hline, and geom_vline functions with ggplot function of ggplot2 package.
Consider the below data frame −
x<-1:5 y<-5:1 df<-data.frame(x,y) df
x y 1 1 5 2 2 4 3 3 3 4 4 2 5 5 1
Loading ggplot2 package and creating point chart between x and y−
Creating point chart between x and y by showing all four quadrants −
- How to create a horizontal bar graph using ggplot2 in R?
- Create a graph without background panel using ggplot2 in R.
- How to create a ggplot2 graph in R without showing values?
- How to create a colored frame for ggplot2 graph in R?
- How to create a horizontal line in ggplot2 graph with different color in R?
- How to create a horizontal line in ggplot2 graph with larger width in R?
- How to rotate a ggplot2 graph in R?
- How to create a boxplot using ggplot2 with aes_string in R?
- How to create a dashed horizontal line in a ggplot2 graph in R?
- How to display a variable with subscript ggplot2 graph in R?
- How to convert ggplot2 graph into a plotly graph in R?
- How to change the title size of a graph using ggplot2 in R?
- How to create a bar plot with ggplot2 using stat_summary in R?
- How to create a scatterplot with two legends using ggplot2 in R?
- How to create a scatterplot with dark points using ggplot2 in R?