Different Types of Plotting Techniques
Learn to make excellent and professional quality figures from our data.
There are some other ways to explore data using ggplot2, namely the following:
- Violin plots
- Histogram and density plots
- Scatter plots
Violin plots
Boxplots are great for seeing some basic information about the spread of data we have, but they can still be somewhat misleading because they don’t show how the data is distributed within the box. One alternative to the boxplot is the violin plot. The coding for a violin plot is the same as the coding for a boxplot, but the geom
is defined as violin
instead of boxplot
. The following code also exemplifies one other great thing about ggplot2. By defining the fill
argument as a variable (not already defined as our x-axis), we can automatically plot the various categories within the treatment.
#Plot the mass data as a violin plotqplot(data=RxP.clean,y=Mass.final,x=Pred,geom='violin',fill=Res)
In the ...