Pandas DataFrame Plot hexbin graph

Pandas plot

Pandas.DataFrame.plot to generate hexbin using data
DataFrame hexbin chart
import pandas as pd 
import numpy as np 
n = 10000
df=pd.DataFrame({'x': np.random.randn(n),
                'y': np.random.randn(n)})

hexbin chart with options

There are several options we can add to above hexbin diagram.

title :

title='hexbin Plot' String used as Title of the graph.

figsize :

Size of the graph , it is a tuple saying width and height in inches, figsize=(6,3). Here width is 6 inches and height is 3 inches.


fontsize=20 , we can set the font size used labels in x and y axis. fontsize=20


color option for hexbin diagram We can use the option colors to give different colors to line . We can use one tuple to define the colours.

df.plot.hexbin(x='x',y='y',gridsize=20,title='hexbin Plot',color=[(.9,.2,.6)])


We will show grid ( grid=True ) or not ( grid=False) grid=True option grid=False option


logx logy loglog

option logy=True We can specify log scaling or symlog scaling for x ( logx=True ) or y ( logy=True ) or for both x & y ( loglog=True)

Pandas plot plot.barh()
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 All rights reserved worldwide Privacy Policy Disclaimer