Skip to main contentSkip to solution

Arrange the following steps to draw a customized scatter plot using matplotlib.

(A) import pandas as pd

(B) use plt.scatter() with customized color, size and marker style

(C) create two data series for x and y values

(D) add labels, title and display the plot

Solution

✅ Correct Option: 1

Libraries must be imported first, and the data must exist before it can be plotted. Only then can the scatter plot be customized, and the labels, title and display call come last, because plt.show() renders the finished plot.

(A) import pandas as pd

(C) create two data series for x and y values

(B) use plt.scatter() with customized color, size and marker style

(D) add labels, title and display the plot


Options 2 and 3: call plt.scatter() before the x and y data exist, which gives an error.

Option 4: puts the import last, but the code cannot run without its libraries imported first.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question