In my project on data wrangling of OpenStreetMap data, I attempted to plot the locations of restaurants using matplotlib in Python.
I was expecting an outline of the major highway in the area, I-35, which runs north to south but from the plot above, the points (locations of restaurants) run from left to right.
As an assignment for the class I’m taking, we needed to learn any of RAW, plot.ly, and Tableau by plotting any dataset. So I used the data from the OpenStreetMap project. Before I can do this, I had to export the dataset to a csv file first. This meant going back to querying the SQLite database I created from the project (code here) and exporting the dataframe with the restaurant type (‘value’) and locations (‘nodes_lat’ and ‘nodes_lon’) into a csv file.
I chose Tableau to plot my data. However, I found that I needed to clean the restaurant types first. This meant reprocessing the csv file and changing the values to appropriate restaurant types so redundant restaurant types are avoided (code here).
The cleaned up csv file was then exported into Tableau and the resulting plot looks like the one below:
The actual plot on Tableau Public is interactive. A particular type of restaurant can be chosen and only those restaurants will be shown in the map.
Comparing the Tableau plot and the matplotlit plot, it looked like the longitude and latitudes were switched in the matplotlib plot. This is because longitude should actually be set in the horizontal axis and the latitudes should be in the vertical axis. It’s just the way it is in plotting longitudes and latitudes.