I have begun to learn about python / matplolib / basemap and really need some help.
My data is in an Excel workbook with the following structure:
Event Number Date Lat LOn Time (UTC) 1 02/may 14,4 -98,9 0145 15,6 -99,9 0215 13,6 -100,9 0245 14,9 -108,8 0315 2 26/may 15,8 -89,7 1245 15,9 -90,8 1315 15,7 -98,9 1345 ...
How to open excel file in python?
I would like to plot multiple line joining the positions of each of the events, it is possible to do this? Have any idea how to do it?
The idea is to plot the trajectories on a particular region, for my case is Mexico.
To open an excel file in python, please see: here
That said, I think it’s even easier if you just save it as a CSV file and then open using numpy.loadtxt However, this may require some reformatting of your data. You can also always build your own parser and use commas as space delimiters. If this is your idea, let me know and I can show you how to do it.
If your axes are latitude and longitude, then create an array of the latitude and longitude and plot using this
Once you have created your lat array and longitude array, your code would look like this:
import matplotlib.pyplot as plt plt.figure() plt.plot(lat, longitude, 'r')