Scatter plots are the most basic plots in exploratory analytics. They help the analyst get a rough idea of the data distribution and the relationship between the corresponding columns, which in turn helps identify some prominent patterns in the data.
We will use the Gadfly
library, which we used in the preceding recipes. So, to install the library, you can follow the installation steps mentioned in the previous recipes.
Let's start off with plotting a simple scatter plot of iris features: the length and the width. This will help us identify the relationship between the two features of the flower. This can be done using a line plot similar to the one in the preceding recipe, but including the aesthetic
Geom.point
instead ofGeom.line
in theplot()
function. This can be done as follows:plot(dataset("datasets", "iris"), x = "SepalLength", y = "SepalWidth", Geom.point)
Next, we will try to put in some aesthetics on the plot to make it more informative...