Pandas DataFrame Plot scatter graph

Pandas plot

Pandas.DataFrame.plot to generate scatter graph using data
DataFrame scatter chart
import pandas as pd 
df =pd.DataFrame(data=my_dict)
df.plot.scatter(title='Sale Vs Visit',x='visit',y='sale')

scatter chart with options

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

title :

title='sale Vs Visit' 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 scatter diagram We can use the option colors to give different colors to points . We can use one tuple to define the colours. Here it is color=[(.9,.4,.2)], this is in R G B format where each value varies from 0 to 1.


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


logx logy loglog

option loglog=True We can specify log scaling or symlog scaling for x ( logx=True ) or log scaling for y ( logy=True ), we can specify both the axis by loglog ( loglog=True)



Rotation of ticks ( check the label at x axis )
rot=45 rot=180

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-2024 All rights reserved worldwide Privacy Policy Disclaimer