How to create a strip chart using lattice package in R?

This recipe helps you create a strip chart using lattice package in R

Recipe Objective

How to create a strip chart using lattice package in R ? A strip chart is a variant of scatter plot where the categorical data is plotted on the X axis Strip charts are useful for plotting small data sets. It shows the variability of the data , whether they are spread or gathered. A term called jitter is used in the syntax which spreads out the data points gathered at a place for better visualization Lattice is a data visualization and graphics package in R - graph_type(formula, data) This recipe demonstrates an example on strip chart.

Step 1 - Install necessary package and library

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

Step 2 - Create a random data

set.seed(1) x <- round(runif(100)) y <- x + rnorm(100) print(x) print(y)

Step 3 - Plot a strip plot

syntax - stripplot(y ~ x,data,main,xlab,ylab) x,y - input variables. data - the input data main - the title of the chart xlab - the title of the x axis ylab - the title of the y axis

stripplot(x ~ y ,main = "Strip chart", xlab = "x_value", ylab = "y_value") # without jitter stripplot(x ~ y , jitter.data = TRUE ,main = "Strip chart", xlab = "x_value", ylab = "y_value") # with jitter

What Users are saying..

profile image

Anand Kumpatla

Sr Data Scientist @ Doubleslash Software Solutions Pvt Ltd
linkedin profile url

ProjectPro is a unique platform and helps many people in the industry to solve real-life problems with a step-by-step walkthrough of projects. A platform with some fantastic resources to gain... Read More

Relevant Projects

Learn How to Build PyTorch Neural Networks from Scratch
In this deep learning project, you will learn how to build PyTorch neural networks from scratch.

Abstractive Text Summarization using Transformers-BART Model
Deep Learning Project to implement an Abstractive Text Summarizer using Google's Transformers-BART Model to generate news article headlines.

Tensorflow Transfer Learning Model for Image Classification
Image Classification Project - Build an Image Classification Model on a Dataset of T-Shirt Images for Binary Classification

Build ARCH and GARCH Models in Time Series using Python
In this Project we will build an ARCH and a GARCH model using Python

Build a Graph Based Recommendation System in Python -Part 1
Python Recommender Systems Project - Learn to build a graph based recommendation system in eCommerce to recommend products.

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.

Skip Gram Model Python Implementation for Word Embeddings
Skip-Gram Model word2vec Example -Learn how to implement the skip gram algorithm in NLP for word embeddings on a set of documents.

NLP Project on LDA Topic Modelling Python using RACE Dataset
Use the RACE dataset to extract a dominant topic from each document and perform LDA topic modeling in python.

Deploying Machine Learning Models with Flask for Beginners
In this MLOps on GCP project you will learn to deploy a sales forecasting ML Model using Flask.

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.