Skip to content

Commit

Permalink
trying centering plots
Browse files Browse the repository at this point in the history
  • Loading branch information
hayesrebecca committed Aug 18, 2024
1 parent 69b7ffd commit ca53ffe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ Each of the issues mentioned above in the cleaning steps were reported to the pr

To clean and filter the network data, we used the packages sqlalchemy, pandas, numpy, geopandas, and shapely. To calculate network metrics, we used networkx. For network visualization, we used folium. We also developed an open-source package available in our github repository with custom functions for each analysis, including the cleaning functions to prepare the data for network analysis.

We ran each network analysis separately for each of the card types: adult, youth, senior, disability, and low-income. We imported the origin-destination trips table for April 2023 from the ORCA postgres database and loaded each table as a pandas geodataframe. Data was filtered following the steps outlined above. We then assigned each stop to the centroid of a 1/4 mile hexagonal grid overlaid on the spatial extent of the stop points to aggregate the data and improve visibility in the plots. Then, we calculated trip frequency and filtered out any duplicates as well as origin-destination trip combinations with fewer instances than 20 that month to focus only on the most frequent trips. Next, we used networkx to create networks for each card type with nodes representing origin and destination location and edges representing trip area. We used the networkx object to calculate network metrics. Then, we used folium to create interactive maps for each card type, excluding the downtown Seattle area to reduce overplotting of the high density-high frequency downtown stops.
We ran each network analysis separately for each of the card types: adult, youth, senior, disability, and low-income. We imported the origin-destination trips table for April 2023 from the ORCA postgres database and loaded each table as a pandas geodataframe. Data was filtered following the steps outlined above. We then assigned each stop to the centroid of a 1/4 mile hexagonal grid overlaid on the spatial extent of the stop points to aggregate the data and improve visibility in the plots. Then, we calculated trip frequency and filtered out any duplicates as well as origin-destination trip combinations with fewer instances than 20 that month to focus only on the most frequent trips. Next, we used networkx to create networks for each card type with nodes representing origin and destination location and edges representing trip area. We used the networkx object to calculate network metrics. Then, we used folium to create interactive maps for each card type, excluding the downtown Seattle area to reduce overplotting of the high density-high frequency downtown stops. For the network edge plots, relative trip frequency was calculated by dividing the trip frequency by the total number of trips in the network and muliplying by 100 to return the percent of total trips represented by each particular trip.


## **Results**

#### Youth card trip network vs. Adult card trip network

<div style="display: flex; justify-content: space-between; gap: 10px;">
<div style="display: flex; justify-content: center; gap: 10px;">
<iframe id="youthMap" src="https://uwescience.github.io/DSSG2024_transit_equity/assets/img/youth_net_no_downtown.html" style="width: 48%; height: 600px; border: none;" onload="centerMap('youthMap')"></iframe>
<iframe id="adultMap1" src="https://uwescience.github.io/DSSG2024_transit_equity/assets/img/adult_no_downtown_network.html" style="width: 48%; height: 600px; border: none;" onload="centerMap('adultMap1')"></iframe>
</div>
Expand Down

0 comments on commit ca53ffe

Please sign in to comment.