I am reading the pandas framework and trying to generate a graph from it. On the graph, the data points are apparently connected in the order determined by the increasing value of y, which leads to a strange plot of a zigzag graph:

The code looks something like this:
from pandas import DataFrame as df import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt data = df.from_csv(...) plt.plot(data['COL1'], data['COL2'])
Any suggestions on how to fix the order of connecting the points (i.e. connect them in the sequence in which they are displayed from left to right on the graph)? Thanks.
source share