How to create a dotplot using lattice package in R?

How to create a dotplot using lattice package in R?

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 :"

Relevant Projects

Learn to prepare data for your next machine learning project
Text data requires special preparation before you can start using it for any machine learning project.In this ML project, you will learn about applying Machine Learning models to create classifiers and learn how to make sense of textual data.

Natural language processing Chatbot application using NLTK for text classification
In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Sequence Classification with LSTM RNN in Python with Keras
In this project, we are going to work on Sequence to Sequence Prediction using IMDB Movie Review Dataset​ using Keras in Python.

Topic modelling using Kmeans clustering to group customer reviews
In this Kmeans clustering machine learning project, you will perform topic modelling in order to group customer reviews based on recurring patterns.

Customer Market Basket Analysis using Apriori and Fpgrowth algorithms
In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Deep Learning with Keras in R to Predict Customer Churn
In this deep learning project, we will predict customer churn using Artificial Neural Networks and learn how to model an ANN in R with the keras deep learning package.

Walmart Sales Forecasting Data Science Project
Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.