Plot multiple lines

Trayectorias-scm-2004.csv (9.59 KB)

Trayectorias-scm-2004.xls (30 KB)

  1. How to open excel file in python?

You can read excel files with the xlrd module : http://www.python-excel.org/

However, you may want to simply read your exported CSV files.

  1. 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?

I’m not quite sure what you are aiming for with this. You should be able to just plot a series of lines, as long as they have common start and end points they will appear joined, but the lines can have different attributes (e.g. color). Or you can plot all the points as a single line with multiple segments (all segments having the same attributes).

···

The idea is to plot the trajectories on a particular region, for my case is Mexico.
<Trayectorias-scm-2004.csv><Trayectorias-scm-2004.xls>------------------------------------------------------------------------------

Boris,

If you can, install pandas and openpyxl on your machine. Pandas and
read in the csv by itself. Openpyxl is only needed if you really want
to read the Excel file.

Sticking with the csv approach, all you'll have to do is this:

import matplotlib.pyplot
import pandas

fig, ax = plt.subplots()
data = pandas.read_csv("/path/to/Trayectorias-scm-2004.csv")
data.plot(ax=ax)

That will plot all of the non-index columns in your dataframe.

Hope that helps,
-paul

···

On Thu, Nov 15, 2012 at 2:48 PM, Boris Vladimir Comi <glez_b@...4243...> wrote:

Hi all:

I have begun to learn about python / matplolib / basemap and really need some help.

  My data is in an Excel workbook in format .xls or csv(see attached):

1. How to open excel file in python?

2. 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.