>2008/12/23 Eric Firing <efir...@hawaii.edu>: > antonv wrote: >> Hi all, >> >> I am trying to plot data from a grib file from noaa ... >> Here is a sample of the code that I am using: >> >> import matplotlib.pyplot as plt >> import matplotlib.mlab as mlab >> >> r = >> mlab.csv2rec('D:/SocalScubaInfo/Data/Outputs/CSV_files/DIRPW_12191800.csv') >> plt.contour(r.longitude, r.latitude) >> plt.show() >> >> Which errors out and requires a 2d array. >> >> By the way, here is a data file: http://downloads.75ive.com/testdata.csv >> http://downloads.75ive.com/testdata.csv >> >> Any help is appreciated! > > > I assume you meant to include your dependent variable in the call to > contour, not just your longitude and latitude. In any case, you need to > grid your data onto a 2D array. In the mpl examples, see griddata_demo.py.
If you just want a quick overview, you could also try >>> plt.scatter(r.longitude, r.latitude, c=r.dirpw_200812191800, s=5, >>> edgecolors='none') >>> plt.colorbar() >>> plt.show() Cheers, Scott ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users