Horizontal Stripplot with Jitter using Altair in Python
Altair is a statistical data visualization library in python which is based on Vega and Vega-Lite visualization grammars. A Stripplot is used for graphical data analysis. It is a simple plot of response values in a sorted order along a single axis. The strip plot consists of 2 distinct axes (X, Y). The strip plots provide an alternative for the histogram and other density-based plots and are often used with small datasets.
A simple strip plot is used for plotting the data as points, which may not be very useful to us. To make the simple stripplot more cultivate we add random jitter. Jitter in simple words is adding a small amount of variability(horizontal or vertical) to the data to ensure all data points are visible. In this article we will discuss how it will be achieved horizontally.
- Import module
- Read or create data
- Now, to create the horizontal stripplot we will interchange our x-axis and y-axis.
- Define jitter for the plot
- Plot the graph
- Display plot
calculate_transform() allows the user to define new fields in the dataset which are calculated from other fields using an expression.