0

There's no range argument in pandas.Series.plot.hist or pandas.Series.plot. But the code below works. How does it work?

#wnba is Dataframe, so wnba['PTS'] is series.
wnba['PTS'].plot.hist(range = (1,600), bins = 3)

1 Answers1

0

plot.hist takes **kwds so, already, however you call it (with whatever keyword args), it'll have a correct syntax.

Semantically:

  1. hist calls self by passing kind='hist' argument,
  2. which means self.__call__,
  3. which, in turn calls plot_series that establishes the ax layer through the _get_ax_layer method,
  4. then _plot is called with this ax and with the kind='hist' argument
  5. which, eventually, means that the HistPlot class will be used
  6. that finally extracts the range kwarg via range=self.kwds.get('range', None)

It's all a matter of patiently following the breadcrumbs.

Adelin
  • 7,809
  • 5
  • 37
  • 65