Strip Plots Using Lattice Package in R
In general, Strip Plots are used to plot univariate data. It’s a 2D plot where on X-Axis the response variables are plotted.
These are alternatives to the histogram or density plot. It is typically used to plot small data sets so here we will be using the iris dataset to implement it.
In, R Programming, the Strip Plots can be implemented using the stripplot() function which is present in the lattice package.
- data – data frame that needs to be considered to plot
- jitter – used to specify whether the values should be jittered or not
- factor – used to specify the amount of jitter
- xlab – used to specify the X-axis label
- main – used to specify the title of the plot
Let’s see the code for Simple Strip Chart. In this, we will be using the iris dataset and plotting the sepal length using stripplot().
We can also plot the Partitioned Strip Plot for each category. Here we are categorizing according to Species column. The code is given below.
We can also customize the plot using col parameter. We can add different colors to the plot.
Please Login to comment...