Skip to main contentSkip to solution

The plot function of pandas matplotlib uses 'kind' argument which can accept a string indicating the type of graph to be plotted. Which of the following are valid plots?

(A) Area

(B) Box

(C) Scatter

(D) Line

Solution

✅ Correct Option: 3

All four are valid values of the kind argument in pandas plot(): 'area', 'box', 'scatter' and 'line'.

The full list of accepted strings is 'line' (default), 'bar', 'barh', 'hist', 'box', 'kde' or 'density', 'area', 'pie', 'scatter' and 'hexbin'.


Options 1, 2 and 4 each leave out one valid kind. The one students most often drop is 'scatter', because it works only on a DataFrame and needs both x and y, for example df.plot(kind='scatter', x='a', y='b'). It is still a valid kind.

Keyboard Shortcuts

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