#*****************************************************************************80 # ## insect_scatter3d makes a 3D scatter plot. # # Discussion: # # This function requires the scatterplot3d library. To install it, start R # and type: # # install.packages ( "scatterplot3d" ) # # For each of three insect species, there is a data file. # # Each data file reports three measurements on 10 individuals # in the species, the first tarsus, second tarsus, and maximum # width of aedeagus. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 01 September 2020 # # Author: # # John Burkardt # library ( scatterplot3d ) cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "insect_scatter3d\n" ) cat ( " ", version$version.string, "\n" ) cat ( " Create a 3D scatter plot of measurements of three\n" ) cat ( " physical characteristics of 3 species of insects.\n" ); filename = "insect_data.txt" data <- read.table ( filename, header = FALSE ) filename = "insect_scatter3d.png" png ( filename ) rgb = c ( "red", "green", "blue" ) colors = rgb [ data[,4] ] scatterplot3d ( data[,1:3], xlab = "<-- First Tarsus -->", ylab = "<-- Second Tarsus -->", zlab = "<-- Max Aedeagus -->", color = colors, main = "Sample Measurements of 3 Insect Species", pch = 16 ) grid ( ) cat ( ' Graphics saved as "', filename, '"\n' ) # # Terminate. # cat ( "\n" ) cat ( "insect_scatter3d:\n" ) cat ( " Normal end of execution.\n" ) quit ( )