How to create a dotplot using lattice package in R?

This recipe helps you create a dotplot using lattice package in R

Recipe Objective

How to create a dotplot using lattice package in R? A dot plot or dot chart is a graphical representation of data points on the graph as circles (dots). A dot plot is similar to a bar plot with the exception of plotting dots instead of bars. Dot plots are used for quantitative/ categorical type of data. Lattice is a data visualization and graphics package in R. This recipe demonstrates an example of dot plots.

Step 1 - Install necessary package and library

install.packages("lattice") library(lattice)

Step 2 - Create a dataframe

data <- data.frame(values = c(10,20,30,40,50,60,70,80,90,100), count = c(5,5,5,5,6,6,6,7,7,7)) print(data)

 "Input data is : " 
   values count
1      10     5
2      20     5
3      30     5
4      40     5
5      50     6
6      60     6
7      70     6
8      80     7
9      90     7
10    100     7

Step 3 - Plot a dot plot

Syntax - dotplot(y ~ x , data , main , xlab, ylab) where, x , y - input variables data - input dataframe main -title of the plot xlab - title of the x axis ylab - title of the y axis

dotplot(values ~ count , data = data,main = "dot plot", xlab="x_data", ylab="y_data")

 " Output of the code is :"

What Users are saying..

profile image

Ray han

Tech Leader | Stanford / Yale University
linkedin profile url

I think that they are fantastic. I attended Yale and Stanford and have worked at Honeywell,Oracle, and Arthur Andersen(Accenture) in the US. I have taken Big Data and Hadoop,NoSQL, Spark, Hadoop... Read More

Relevant Projects

Credit Card Default Prediction using Machine learning techniques
In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

Azure Text Analytics for Medical Search Engine Deployment
Microsoft Azure Project - Use Azure text analytics cognitive service to deploy a machine learning model into Azure Databricks

Model Deployment on GCP using Streamlit for Resume Parsing
Perform model deployment on GCP for resume parsing model using Streamlit App.

Langchain Project for Customer Support App in Python
In this LLM Project, you will learn how to enhance customer support interactions through Large Language Models (LLMs), enabling intelligent, context-aware responses. This Langchain project aims to seamlessly integrate LLM technology with databases, PDF knowledge bases, and audio processing agents to create a comprehensive customer support application.

Isolation Forest Model and LOF for Anomaly Detection in Python
Credit Card Fraud Detection Project - Build an Isolation Forest Model and Local Outlier Factor (LOF) in Python to identify fraudulent credit card transactions.

Recommender System Machine Learning Project for Beginners-3
Content Based Recommender System Project - Building a Content-Based Product Recommender App with Streamlit

BERT Text Classification using DistilBERT and ALBERT Models
This Project Explains how to perform Text Classification using ALBERT and DistilBERT

Build an Image Segmentation Model using Amazon SageMaker
In this Machine Learning Project, you will learn to implement the UNet Architecture and build an Image Segmentation Model using Amazon SageMaker

Build Piecewise and Spline Regression Models in Python
In this Regression Project, you will learn how to build a piecewise and spline regression model from scratch in Python to predict the points scored by a sports team.

Create Your First Chatbot with RASA NLU Model and Python
Learn the basic aspects of chatbot development and open source conversational AI RASA to create a simple AI powered chatbot on your own.