Issue
I have a dataset of traffic flow for different stations.
I am trying to plot them only for a limited time like summer. When I plot, I can see there is a line crossing all the plot in each of them.
fig, ax = plt.subplots(nrows=16, figsize=(60,120))
stations = countData19_gdf['address'].unique()
print(len(stations))
summersubset = countData19_gdf.loc['2019-06-01': '2019-08-31']
cnt=0
for station in stations:
station_data = summersubset[summersubset['address'] == station]
ax[cnt].plot( station_data['volume'], c='green', label= 'flow')
ax[cnt].title.set_text(station)
ax[cnt].set_xlabel('Study Date')
ax[cnt].set_ylabel('volume (V/15 minutes)')
ax[cnt].set_title(station)
ax[cnt].grid(True)
ax[cnt].xaxis.set_major_locator(DayLocator())
ax[cnt].xaxis.set_major_formatter(DateFormatter('%m/%d'))
ax[cnt].legend(loc='upper left')
cnt = cnt +1
Solution
As John Hennig suggested in the comments, I just ordered the index before the plot, and it worked.
gdf = gdf.sort_index()
Answered By - GeoBeez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.