In this recipe, we will create a three-dimensional bar chart. The three-dimensional bar chart will follow the same command as that of a scatter plot, but we will utilize the drop-line functionality to produce this 3D visualization.
Let's call the airquality
dataset. In this particular recipe, we will use the Day
, Month
, and Temp
variables. The Day
and Month
variables will represent two axes, whereas Temp
will represent the third axis that gives the value of the temperature.
The command used here is similar to the scatter plot with the drop line added, but this time, we will hide the point and just represent each bar based on the value of the third variable. Here is the code:
scatterplot3d(Day,Month,Temp,type="h",lwd=5,pch=" ",color="grey10")