Ensure the scatterplot3d library has been loaded in your current R session.
a. Turn your attention back to the diabetes data frame found in the faraway package (you first looked at these data in Section 21.5.2). Your goal is to produce a scatterplot3d plot of weight, hip, and waist measurements as per the following guidelines:
– Hip, waist, and weight variables should correspond to the x-axis, y-axis, and z-axis, respectively; provide neat axis titles.
– Use built-in functionality to ensure the 3D depth is highlighted by color.
– Choose two different point characters to reflect gender.
– Place a simple legend referencing these two point characters and gender in the blank space in the upper-left area.
b. Create a 3D scatterplot of the built-in airquality data, which you first met in Section 24.2.2, according to the following guidelines:
– Create a copy of the data frame using na.omit to remove all rows that contain missing values and work with this copy.
– Plot wind speed and solar radiation against the x- and y-axes, respectively, using the z-axis to plot temperature.
– Apply vertical dotted lines reaching up from the x-y plane to each observation.
– The data in airquality are comprised of measurements taken over five months, from May to September. Each plotted point should take on the corresponding pch value from 1 to 5 respective to the order of these five months.
– With a vector of 50 colors generated from the built-in topo.colors palette, use the categorization approach to ensure each plotted point is colored according to its ozone value.
– Set a legend to reference the five point types according to month.
– Set a color legend (using functionality from the shape package) to reference the ozone value accordingly.
– Ensure the plot has neat axis, main, and legend titles.