Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Data Visualization
  • Statistics in R
  • Machine Learning in R
  • Data Science in R
  • Packages in R
  • Data Types
  • String
  • Array
  • Vector
  • Lists
  • Matrices
  • Oops in R
Open In App
Next Article:
Create Dot Charts in R Programming - dotchart () Function
Next article icon

Create Dot Charts in R Programming - dotchart () Function

Last Updated : 11 Apr, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

dotchart() function in R Language is used to create a dot chart of the specified data. A dot chart is defined as a plot which is used to draw a Cleveland dot plot.

Syntax: dotchart(x, labels = NULL, groups = NULL, gcolor = par("fg"), color = par("fg")) Parameters: x: it is defined as numeric vector or matrix labels: a vector of labels for each point. groups: a grouping variable indicating how the elements of x are grouped. gcolor: color to be used for group labels and values. color: the color(s) to be used for points and labels.

Example 1: 

r
# Dot chart of a single numeric vector dotchart(mtcars$mpg, labels = row.names(mtcars),          cex = 0.9, xlab = "mpg") 

Output: Example 2: 

r
# Plot and color by groups cyl grps <- as.factor(mtcars$cyl) my_cols <- c("blue", "darkgreen", "orange") dotchart(mtcars$mpg, labels = row.names(mtcars),          groups = grps, gcolor = my_cols,          color = my_cols[grps],          cex = 0.9,  pch = 22, xlab = "mpg") 

Output:

Example :

R
# Create a vector of data data <- c(3, 8, 12, 15, 19, 22, 24, 27, 30)  # Create a vector of labels for the data points labels <- c("A", "B", "C", "D", "E", "F", "G", "H", "I")  # Create a dot chart dotchart(data, labels = labels, main = "Dot Chart Example", xlab = "Value", ylab = "Label") 

output :

 

Next Article
Create Dot Charts in R Programming - dotchart () Function

K

kaurbal1698
Improve
Article Tags :
  • R Language
  • R Plot-Function

Similar Reads

    Adding axis to a Plot in R programming - axis () Function
    axis() function in R Language is to add axis to a plot. It takes side of the plot where axis is to be drawn as argument. Syntax: axis(side, at=NULL, labels=TRUE) Parameters: side: It defines the side of the plot the axis is to be drawn on possible values such as below, left, above, and right. at: Po
    2 min read
    Adding Colors to Charts in R Programming
    R Programming language is mostly used for statistics and data analytics purposes to represent the data graphically in the software. To represent those data graphically, charts and graphs are used in R.  Adding Colors to Charts in R Programming There are hundreds of charts and graphs present in R. Fo
    4 min read
    How to Create Radar Charts in R?
    In this article, we are going to see how to create Radar Charts in R Programming Language. Radar charts are also known as Spider or Web or Polar charts. It is a graphical graph to display multivariate data in form of 2D charts of three or more quantitative variables which are represented on axes sta
    4 min read
    Create One Dimensional Scatterplots in R Programming - stripchart() Function
    Strip Chart is defined as one dimensional scatter plots or dot plots which is used as an alternative to box plot when sample sizes are small. It is created using the stripchart() function in R Language. R - stripchart Function Syntax: stripchart(x, data = NULL method, jitter ) Parameters:  x : value
    3 min read
    Create a Plot Matrix of Scatterplots in R Programming - pairs() Function
    pairs() function in R language is used to return a plot matrix, consisting of scatter plots corresponding to each data frame. R - Create Plot Matrix of Scatterplots Syntax: pairs(data) Parameters:  data: It is defined as  value of pairs Plot. Returns: Color, Labels, Panels, and by Group in pairs plo
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences