--- title: Drill 5 Solution tags: Drills-F20, 2020 --- # Drill Solutions Template For the following questions, refer to this table, named `planet-data`. ![](https://i.imgur.com/dpB72kG.png) ## Question 1 How would you use the plotting library to make this scatter plot? ![](https://i.imgur.com/sWE6pyZ.png) ( ) `plot(planet-data, "distance_from_sun", "orbital_speed")` ( ) `scatter-plot(planet-data, "orbital_speed", "distance_from_sun") ` ( ) `scatter-plot(planet-data, "distance_from_sun", "orbital_speed")` ( ) `plot(planet-data, "orbital_speed, "distance_from_sun")` ::: spoiler Answer `scatter-plot(planet-data, "distance_from_sun", "orbital_speed")` The scatter-plot function takes in the name of the table, the string column name for the x-axis, and the string column name for the y-axis. ::: ## Question 2 Fill in the blanks to create this pie chart: ![](https://i.imgur.com/P0rd2Bh.png) pie-chart(planet-data, [arg1], [arg2]) Arg1: ______ Arg2: ______ ::: spoiler Answer Arg1: "planet" Arg2: "mass" The pie-chart function takes in the name of the table, the string column name for the labels, and the string column name for the values in the pie chart. ::: ## Question 3 Which of these answer choices correctly displays a histogram that shows the distribution of the planets' mass with a bin-width of 50? ( ) histogram(planet-data, 50, "mass") ( ) histogram(planet-data, "planet", "mass") ( ) histogram(planet-data, "mass", "planet") ( ) histogram(planet-data, "mass", 50) ::: spoiler Answer histogram(planet-data, "mass", 50) The histogram function takes in the name of the table, the string column name for the value to analyze, and a number for the bin-width of the histogram. ::: ## Question 4 True or False-- The functions in the plotting library all output data of type Plot. ( ) True ( ) False :::spoiler Answer False The plotting functions all output data of type Image. ::: ## Question 5 Write the function call to produce this graph. ![](https://i.imgur.com/6EUTVeS.png) :::spoiler Answer ```bar-chart(planet-data, "planet", "radius")``` The bar-chart function takes in the name of the table, the string column name for the x-axis, and the string column name for the y-axis. ::: ## Question 6 Write the function call to produce this graph. ![](https://i.imgur.com/0W3EjkV.png) :::spoiler Answer ```box-plot(planet-data, "radius")``` The box-plot function takes in the name of the table and the string column name of the value to analyze. :::