A hexagon bin plot can be created using the
DataFrame.plot() function and
kind = 'hexbin'. This kind of plot is really useful if your scatter plot is too dense to interpret. It helps in binning the spatial area of the chart and the intensity of the color that a hexagon can be interpreted as points being more concentrated in this area.
The following code helps in plotting the hexagon bin plot, and the structure of the code is similar to the previously discussed plots:
>>> df = pd.DataFrame(np.random.randn(1000, 2), columns=['a', 'b']) >>> df['b'] = df['b'] + np.arange(1000) >>> df.plot(kind='hexbin', x='a', y='b', gridsize=25)
After the preceding code is executed we'll get the following output: