- 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

How to create a point chart in R with alternative points having different shape?

The pch argument is used to create different points in a base R chart and if we want to have alternative points of different shape then we can use rep function with pch argument but we need to use it for the exact length of the vector. For example, if we want to create a point chart of a vector that contains 10 values having different shapes of alternate points then we can use pch=rep(1:2,5)).

> x<-rnorm(10) > plot(x,pch=rep(1:2,5))

Let’s have a look at another example:

> y<-sample(0:10,10) > plot(y,pch=rep(5:6,5))

- Related Questions & Answers
- How to create plot in R with different shape of points?
- How to create a point chart with empty points using ggplot2 in R?
- How to join points in a point chart with lines using ggplot2 in R?
- How to create a scatterplot using ggplot2 with different shape and color of points based on a variable in R?
- How to create a point chart for categorical variable in R?
- How to create a point chart with point size increment based on the position of the point in R?
- How to create a point chart for cumulative sums using ggplot2 in R?
- How to create a scatterplot in R using ggplot2 with different designs of points?
- How to create a barplot with one of the bars having different color in R?
- How to create boxplot of vectors having different lengths in R?
- How to delete lines after creating a line chart with points in base R?
- How to join the points of a point chart if X-axis values are categorical in R using ggplot2?
- How to create bar chart using ggplot2 with chart sub-title in R?
- How to create a scatterplot with dark points using ggplot2 in R?
- How to create plotly bar chart with negative values in R?

Advertisements