#*****************************************************************************80 # ## iris_subplots creates a scatter plot from Corvette data. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 07 September 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "iris_subplots\n" ) cat ( " ", version$version.string, "\n" ) cat ( " For each of 3 varieties of iris, a number of specimens\n" ) cat ( " have been collected. For each specimen, measurements\n" ) cat ( " made of sepal length (x1), sepal width (x2), petal length (x3)\n" ) cat ( " and petal width (x4).\n" ) cat ( "\n" ) cat ( " Create a 4x4 array of scatter plots that compare each\n" ) cat ( " pair of values. Moreoever, use colors to distinguish the\n" ) cat ( " data belonging to each of the three varieties.\n" ) # # Read the three sets of x1, x2, x3, x4 data: # filename = "iris_setosa_data.txt" setosa <- read.table ( filename, header = FALSE ) filename = "iris_versicolor_data.txt" versicolor <- read.table ( filename, header = FALSE ) filename = "iris_virginica_data.txt" virginica <- read.table ( filename, header = FALSE ) # # Request a 4 x 4 array of plots. # par ( mfrow = c ( 4, 4 ) ) # # Request bottom, left, top, right margin sizes. # par ( mar = c ( 0.1, 0.1, 0.1, 0.1 ) ) # # Create the plots. # filename = "iris_subplots.png" png ( filename ) for ( i in 1 : 4 ) { for ( j in 1 : 4 ) { plot ( setosa[,i], setosa[,j], col = "red", lwd = 3, type = "p", xaxt = "n", yaxt = "n", ann = FALSE ) points ( versicolor[,i], versicolor[,j], col = "green" ) points ( virginica[,i], virginica[,j], col = "blue" ) grid ( ) } } cat ( ' Graphics saved as "', filename, '"\n' ) # # Terminate. # cat ( "\n" ) cat ( "iris_subplots:\n" ) cat ( " Normal end of execution.\n" ) quit ( )