How to plot two columns of a pandas data frame using points

You can specify the style of the plotted line when calling df.plot:

df.plot(x='col_name_1', y='col_name_2', style="o")

The style argument can also be a dict or list, e.g.:

import numpy as np
import pandas as pd

d = {'one' : np.random.rand(10),
     'two' : np.random.rand(10)}

df = pd.DataFrame(d)

df.plot(style=['o','rx'])

All the accepted style formats are listed in the documentation of matplotlib.pyplot.plot.

Output

Leave a Comment