Try   HackMD

Drill Solutions Template

For the following questions, refer to this table, named planet-data.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Question 1

How would you use the plotting library to make this scatter plot?

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

( ) 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")

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:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

pie-chart(planet-data, [arg1], [arg2])

Arg1: ______

Arg2: ______

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)

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

Answer

False

The plotting functions all output data of type Image.

Question 5

Write the function call to produce this graph.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

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.