- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the different types of point available in geom_point of ggplot2 package in R?
We can create a point chart using ggplot2 package but that point not necessarily to be in circular shape, we have twenty-five shape options for those points in ggplot2. While creating a point chart using ggplot2, we can use shape argument inside geom_point to see the difference among these twenty-five shapes.
Example
Consider the below data frame:
> set.seed(1957) > x<-rnorm(10,1,0.38) > y<-rnorm(10,1,0.67) > df<-data.frame(x,y) > df
Output
x y 1 0.7028704 1.6664500 2 0.9672393 1.0456639 3 1.3102736 0.2495795 4 0.3389941 0.2141513 5 0.5867095 0.4417377 6 0.4257543 0.6533757 7 0.9106756 0.3611954 8 1.0444729 1.3770588 9 0.9151447 0.7225429 10 1.5207510 1.1613454
Loading ggplot2 package and creating a point chart with shape = 1:
Example
> library(ggplot2) > ggplot(df,aes(x,y))+geom_point(shape=1)
Output:
Creating a point chart with shape = 8:
Example
> ggplot(df,aes(x,y))+geom_point(shape=8)
Output:
Creating a point chart with shape = 25:
Example
> ggplot(df,aes(x,y))+geom_point(shape=25)
Output:
Creating a point chart with shape = 16:
Example
> ggplot(df,aes(x,y))+geom_point(shape=16)
Output:
- Related Articles
- What are the different types of LED available?
- What are the different types of wait available in Selenium?
- What are different types of access modifiers available in C#?
- How to change default point size of geom_point in R?
- What are the different types of DOM available to access and modify content in JavaScript?
- How to change the point size in geom_point conditionally in R?
- How to get the list of data sets available in base R or in a package in R?
- What are the different types of classes in Java?
- What are the different types of keywords in Java?
- What are the Different Types of Demand in Market?
- What are the different types of schedules in DBMS?
- What are the collection types that are available in Swift?
- What are the different types of psychotherapy?
- What are the Different Types of Marketing?
- What are the different types of fabrics?

Advertisements