- 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
How to change the size of dots in dotplot created by using ggplot2 in R?
To change the size of dots in dotplot created by using ggplot2, we can use binwidth argument inside geom_dotplot. For example, if we have a data frame called df that contains a column x for which we want to create the dotplot then the plot with different size of dots can be created by using the command ggplot(df,aes(x))+geom_dotplot(binwidth=2).
Example
Consider the below data frame −
x<-rpois(20,5) df<-data.frame(x) df
Output
x 1 1 2 3 3 6 4 3 5 5 6 11 7 2 8 3 9 2 10 6 11 5 12 4 13 4 14 6 15 8 16 6 17 8 18 9 19 4 20 7
Loading ggplot2 package and creating a dotpot for data in df with different size of dots −
Example
library(ggplot2) ggplot(df,aes(x))+geom_dotplot(binwidth=1)
Output
Example
ggplot(df,aes(x))+geom_dotplot(binwidth=0.5)
Output
Example
ggplot(df,aes(x))+geom_dotplot(binwidth=2)
Output
- Related Articles
- How to change the abline colour created using ggplot2 in R?
- How to change the angle of annotated text in plot created by using ggplot2 in R?
- How to change the tick size using ggplot2 in R?
- How to change the Y axis limit for boxplot created by using ggplot2 in R?
- How to change legend values in a bar plot created by using ggplot2 in R?
- How to change the gridlines of Y-axis on a chart created by using ggplot2 in R?
- How to make all text size same in a plot created by using ggplot2 in R?
- How to change the thickness of the borders of bars in bar plot created by using ggplot2 in R?
- How to change the title size of a graph using ggplot2 in R?
- How to change the bars color to grey shade of a bar graph created by using ggplot2 in R?
- How to change the text size of Y-axis title using ggplot2 in R?
- How to reverse the X-axis labels of scatterplot created by using ggplot2 in R?
- How to change the order of boxplot by means using ggplot2 in R?
- How to increase the width of the lines in the boxplot created by using ggplot2 in R?
- How to change the color and size of the axes labels of a plot created by using plot function in R?

Advertisements