Ok, but can anyone please help me with how to find nlons and nlats dynamically.I need to do this becuase I have no idea on how many records the datasets contains.
i tried user Timmes idea (but it aint working,not even starting): from matplotlib.mlab import load import matplotlib.pyplot as plt import numpy as np data = np.loadtxt("C:/Users/Linda/data.txt") y=data[:,0] x=data[:,1] z=data[:,2] ### data is loaded from a CSV file ### lats = y # data[:,0] ## lon => x lons = x # data[:,1] ## values => z values = z # ### lat_uniq = list(set(lats.tolist())) nlats = len(lat_uniq) lon_uniq = list(set(lons.tolist())) nlons = len(lon_uniq) color_map = plt.cm.spectral print lats.shape, nlats, nlons yre = lats.reshape(nlats,nlons) xre = lons.reshape(nlats,nlons) zre = values.reshape(nlats,nlons) #### later in the defined map CT = plt.contourf(xre, yre, zre, cmap=color_map) cbar = plt.colorbar() plt.show() I have also tried to use griddata but no luck xi = np.linspace(-100,100,100) yi = np.linspace(-100,100,100) # grid the data. zi = griddata(x,y,z,xi,yi) here is the datafile 40 7 10.65251434 41 7.20 16.841345477 42 7.5 10.923153289 46 7.75 13.644313708 45 8 3.550977951 45 8.25 3.352525137 45 8.5 3.080082094 45 8.75 2.971992657 45 9 2.998723785 45 9.25 3.080082094 45 9.5 3.185687405 45 9.75 3.102075854 45 10 3.185687405 45 10.25 3.213960325 45 10.5 3.32326373 45 10.75 3.465643983 45 11 3.612980369 45 11.25 3.644313708 45 11.5 30.701277511 45 11.75 30.923153289 45 12 3.797848342 45 12.25 3.612980369 45 12.5 3.435577844 45 12.75 3.294210812 45 13 3.26536503 45.25 7 16.485050223 45.25 7.25 16.343081631 45.25 7.5 13.856783573 45.25 7.75 13.405725407 45.25 8 13.550977951 45.25 8.25 13.294210812 45.25 8.5 3.294210812 45.25 8.75 3.185687405 45.25 9 3.15761656 45.25 9.25 3.213960325 45.25 9.5 3.15761656 45.25 9.75 3.32326373 45.25 10 3.405725407 45.25 10.25 3.495925216 45.25 10.5 3.465643983 45.25 10.75 3.550977951 45.25 11 3.465643983 45.25 11.25 3.765429652 45.25 11.5 3.95669157 45.25 11.75 3.797848342 45.25 12 3.923153289 45.25 12.25 3.733239867 45.25 12.5 3.550977951 45.25 12.75 3.520306012 45.25 13 3.376085288 45.5 7 6.383367092 45.5 7.25 6.383367092 45.5 7.5 6.009422688 45.5 7.75 4.679469855 45.5 8 3.435577844 45.5 8.25 3.435577844 45.5 8.5 3.236725042 45.5 8.75 3.236725042 45.5 9 3.185687405 45.5 9.25 3.102075854 45.5 9.5 3.102075854 45.5 9.75 3.185687405 45.5 10 3.352525137 45.5 10.25 3.405725407 45.5 10.5 3.376085288 45.5 10.75 3.612980369 45.5 11 3.520306012 45.5 11.25 3.352525137 45.5 11.5 3.823949103 45.5 11.75 3.856783573 45.5 12 3.856783573 45.5 12.25 3.765429652 45.5 12.5 3.669541114 45.5 12.75 3.550977951 45.5 13 3.435577844 45.75 7 5.309043916 45.75 7.25 6.057519881 45.75 7.5 5.030958443 45.75 7.75 4.836570243 45.75 8 4.836570243 45.75 8.25 2.724965001 45.75 8.5 2.607751091 45.75 8.75 3.26536503 45.75 9 2.898163214 45.75 9.25 2.872155245 45.75 9.5 1.893252754 45.75 9.75 2.043669061 45.75 10 1.75488883 45.75 10.25 2.004264146 45.75 10.5 2.971992657 45.75 10.75 1.804949998 45.75 11 2.846334614 45.75 11.25 5.519419657 45.75 11.5 2.517818813 45.75 11.75 3.733239867 45.75 12 3.376085288 45.75 12.25 3.550977951 45.75 12.5 14.612980369 45.75 12.75 10.520306012 45.75 13 31.495925216 46 7 5.06399168 46 7.25 4.949174095 46 7.5 5.266087828 46 7.75 5.352298328 46 8 4.757472437 46 8.25 2.800325674 46 8.5 3.612980369 46 8.75 3.185687405 46 9 2.323282473 46 9.25 1.671485743 46 9.5 3.856783573 46 9.75 4.572079662 46 10 4.679469855 46 10.25 4.679469855 46 10.5 5.309043916 46 10.75 3.294210812 46 11 3.405725407 46 11.25 3.669541114 46 11.5 3.495925216 46 11.75 4.255093726 46 12 3.495925216 46 12.25 3.185687405 46 12.5 3.213960325 46 12.75 3.550977951 46 13 3.520306012 46.25 7 1.969297411 46.25 7.25 14.908706364 46.25 7.5 3.052767233 46.25 7.75 3.765429652 46.25 8 3.95669157 46.25 8.25 5.06399168 46.25 8.5 5.266087828 46.25 8.75 3.669541114 46.25 9 3.185687405 46.25 9.25 3.797848342 46.25 9.5 13.352525137 46.25 9.75 15.439709782 46.25 10 25.69098301 46.25 10.25 4.949174095 46.25 10.5 5.736883145 46.25 10.75 5.105542055 46.25 11 4.255093726 46.25 11.25 3.701277511 46.25 11.5 4.255093726 46.25 11.75 4.572079662 46.25 12 3.98369323 46.25 12.25 4.148941623 46.25 12.5 3.129746478 46.25 12.75 3.236725042 46.25 13 3.550977951 46.5 7 2.872155245 46.5 7.25 3.701277511 46.5 7.5 3.15761656 46.5 7.75 3.765429652 46.5 8 5.18951259 46.5 8.25 6.105948261 46.5 8.5 5.266087828 46.5 8.75 5.69098301 46.5 9 16.009422688 46.5 9.25 5.147381739 46.5 9.5 5.829636932 46.5 9.75 5.654489904 46.5 10 6.243327668 46.5 10.25 5.395852976 46.5 10.5 5.736883145 46.5 10.75 6.057519881 46.5 11 5.147381739 46.5 11.25 3.520306012 46.5 11.5 3.856783573 46.5 11.75 4.148941623 46.5 12 4.71833512 46.5 12.25 4.71833512 46.5 12.5 3.701277511 46.5 12.75 3.889851131 46.5 13 3.32326373 46.75 7 1.859766825 46.75 7.25 2.198852355 46.75 7.5 2.345277833 46.75 7.75 2.517818813 46.75 8 3.856783573 46.75 8.25 3.856783573 46.75 8.5 5.06399168 46.75 8.75 4.184077131 46.75 9 5.829636932 46.75 9.25 3.644313708 46.75 9.5 3.765429652 46.75 9.75 5.309043916 46.75 10 6.009422688 46.75 10.25 5.147381739 46.75 10.5 5.609155594 46.75 10.75 5.783100444 46.75 11 5.147381739 46.75 11.25 3.581868928 46.75 11.5 4.908706364 46.75 11.75 3.465643983 46.75 12 3.465643983 46.75 12.25 4.148941623 46.75 12.5 3.98369323 46.75 12.75 3.581868928 46.75 13 3.644313708 -- View this message in context: http://www.nabble.com/Colormap-using-%28UV%29coordinates-from-file-tp23572972p23576916.html Sent from the matplotlib - users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users