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.
set.seed(1) x <- round(runif(100)) y <- x + rnorm(100) print(x) print(y)
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