# cross-tabulation and plot in matplotlib

Dear All,

I am sorry for the bother, but could you please give me some help?
I have some pilot data, which is too large to graph in excel, about 16MB. So I hope I can do the cross-tabulation and plot in matlab. How can I draw a cross-table and graph with matlab like the one in the attachment?

Thank you so much for your time ! Good night!

He Jibo
hejibo@…287…
jibohe2@…1875…

···

He Jibo
Department of Psychology,
Beckman Institute for Advanced Science and Technology
University of Illinois, Urbana Champaign,
603 East Daniel St.,
Champaign, IL 61820

Tel: 217-244-4461(office)
217-244-6763(lab)
Email: hejibo@…287…
Helen Hayes - “Age is not important unless you’re a cheese.”

Hi,
you might want to look here:
http://matplotlib.sourceforge.net/tutorial.html
If I understand what you mean by cross-table and graph, then you are just plotting two lines of data?

That would require:
pylab.plot(x, y1, ‘ro’, x, y2, ‘bo’)
or something like that. Look at the tutorials.

And you would need the data. A good idea is to write them in a simple ascii file.
Please have a look at the following page:

http://www.scipy.org/Cookbook/InputOutput

This would require for example:
data = numpy.loadtxt(‘table.dat’, unpack=True)

When I need to plot data from a file where the data is seperated by comma (csv file), I do something like this:

import pylab
data = pylab.load(filename, delimiter=‘,’,skiprows=1) # the first row is often a table header

fig = pylab.figure()
ax = fig.add_subplot(111) # if you need more then one plot per figure, just change here
ax.set_xlabel(cals[‘x units’])
ax.set_ylabel(‘y units’)
ax.plot(data[::,0],data2[::,1]) # this plots col 0 against col 1, uses all the rows

ax.autoscale_view()
ax.grid(True)
pylab.show()

Cheers,
Stefan

2008/10/15 He Jibo <hejibo@…287…>

···

Dear All,

I am sorry for the bother, but could you please give me some help?

I have some pilot data, which is too large to graph in excel, about 16MB. So I hope I can do the cross-tabulation and plot in matlab. How can I draw a cross-table and graph with matlab like the one in the attachment?

Thank you so much for your time ! Good night!

He Jibo
hejibo@…287…
jibohe2@…1875…

He Jibo
Department of Psychology,
Beckman Institute for Advanced Science and Technology
University of Illinois, Urbana Champaign,
603 East Daniel St.,
Champaign, IL 61820

Tel: 217-244-4461(office)
217-244-6763(lab)
Email: hejibo@…287…
Helen Hayes - “Age is not important unless you’re a cheese.”

This SF.Net email is sponsored by the Moblin Your Move Developer’s challenge

Build the coolest Linux based applications with Moblin SDK & win great prizes

Grand prize is a trip for two to an Open Source event anywhere in the world

http://moblin-contest.org/redirect.php?banner_id=100&url=/

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users