- 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 plot in R with different shape of points?
In base R, the plot with different shape of points can be created by using pch argument inside the plot function. The list of pch values with shape is as written below −
pch = 0 display square pch = 1 display circle pch = 2 display triangle point up pch = 3 display plus pch = 4 display cross pch = 5 display diamond pch = 6 display triangle point down pch = 7 display square cross pch = 8 display star pch = 9 display diamond plus pch = 10 display circle plus pch = 11 display triangles up and down pch = 12 display square plus pch = 13 display circle cross pch = 14 display square and triangle down pch = 15 display filled square pch = 16 display filled circle pch = 17 display filled triangle point-up pch = 18 display filled diamond pch = 19 display solid circle pch = 20 display bullet (smaller circle) pch = 21 display filled circle blue pch = 22 display filled square blue pch = 23 display filled diamond blue pch = 24 display filled triangle point-up blue pch = 25 display filled triangle point down blue
Consider the below vectors and create a point chart with three different shapes −
x<-sample(0:5,20,replace=TRUE) y<-sample(1:10,20,replace=TRUE) plot(x,y,pch=c(16,17,18))
Creating the same plot with different colors of the shapes −
- How to create a point chart in R with alternative points having different shape?
- How to create a scatterplot using ggplot2 with different shape and color of points based on a variable in R?
- How to create histogram like plot with different color of bars in R?
- How to create a scatterplot in R using ggplot2 with different designs of points?
- How to create a plot in R with a different plot window size using plot function?
- How to create density plot for categories filled with different colors in R?
- How to display outliers in boxplot with different shape in base R?
- How to create bar plot in base R with different limits for Y-axis?
- How to create a plot in R with gridlines using plot function?
- How to create a line that passes through specified points in an R plot?
- How to create a scatterplot in R using ggplot2 with transparency of points?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?
- How to create a scatterplot with colors of the group of points in R?
- How to create a plot with cross sign in R?
- How to create ACF plot in R?