Reputation: 43
This is my code on jupyter notebook so far and I'm wondering if I could get point 1 and point 8 connected?
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv("data.txt")
fig, ax = plt.subplots()
data.plot(x="Eastings", y="Northings", ax=ax)
data.plot.scatter(x="Eastings", y="Northings", ax=ax)
station_list = data["Station"].values.tolist()
x = data["Eastings"].values.tolist()
y = data["Northings"].values.tolist()
for i, txt in enumerate(station_list):
plt.annotate(txt, (x[i], y[i]), size=10, xytext=(1,5), ha='center', textcoords='offset points')
This is what it looks like right now.
Upvotes: 0
Views: 410
Reputation: 29992
Connect first and last point with plot()
.
data.plot(x="Eastings", y="Northings", ax=ax, color='b')
data.plot.scatter(x="Eastings", y="Northings", ax=ax)
ax.plot(data.iloc[[0, -1]]['Eastings'], data.iloc[[0, -1]]['Northings'], color='b')
Upvotes: 2