Re: [Matplotlib-users] Fetching a data slab with NetCDFFile
Arthur M. Greene wrote: > Just to add a little info: > > I've been poking around various OPeNDAP servers looking for files to > try and open (and read), and have had a little success, so the module > does seem to work, if not all the time for my purposes. At the moment > I'm on a 64-bit machine (Fedora 10), so this is encouraging. Some > details: > > I tried several of the IPCC AR4 models at PCMDI, with results similar > to what I reported earlier. The time object appears with neither units > nor a calendar. Looking at the metadata shows this not to be correct, > for at least the three models I investigated (gfdl_cm2_1, mpi_echam5, > ncar_ccsm3_0). I believe the inclusion of units and a calendar are > standard procedure for all of these models, and would probably cause > the dataset to be flagged if they weren't present. Many users (like > hundreds) have downloaded and analyzed these files. > > The IRI data library (http://iridl.ldeo.columbia.edu/) has a large > collection of datasets, all available using opendap. But I had > problems with the ones I tried because the calendars seem all to be > given as "360", rather than "360_day". (Perhaps someone is cutting > corners with the typing, I can't say...) I couldn't correct this by > setting timedata.calendar='360_day' because the files are opened > read-only. There must be files on this server with differently-defined > calendars, since the data come from many different sources. I'll have > to root around some more to turn some up. Arthur: It's only the time manipulation functions (date2index, num2date, date2num) that require the time attributes to be CF compliant. You can still read the data with the netCDF module, even if the time attributes are not CF compliant, or not there at all. It is odd that the time attributes appear missing. That does appear to be a bug in the client, or could it have something to do with the fact that the PCC openDAP pages at LLNL appear to be password protected? I'll email the unidata folks and see what they think. Thanks for your all your testing. -Jeff > > Similarly, the time units in > http://test.opendap.org/opendap/data/nc/data.nc are given simply as > 'hour', so num2date can't figure out what dates the time values refer > to. I wouldn't have expected this at this URL, but maybe it's a test? > Aside from the fact that "... since" was missing, netcdf4 also > complained that 'hour' was not an acceptable unit. Only 'hours' will > do. (No 'months' or 'years' either, it seems.) > > http://test.opendap.org/opendap/data/nc/coads_climatology.nc seems to > download OK, and there are units, but it's a 12-month climatology, so > calendar is irrelevant. I could plot the data, although it appeared > reversed left-to-right. (I didn't add axes, but just plotted it raw.) > > The conclusion seems to be that (1) there may be a lot of > non-conforming datasets out there (and netcdf4 may be a little fussy > about what time units it will accept, too), but (2) since there seems > to be some discordance w.r.t. the IPCC data (where we believe the > units and calendar must actually be present) one cannot be absolutely > sure that all of the problems experienced are solely due to malformed > data descriptions. Evidently more detective work will be required to > sort everything out... > > Best, thanks again for the assistance. I've been up too late chasing > around the web... > > Arthur > > > Jeff Whitaker wrote: >> Arthur M. Greene wrote: >>> Thanks much. I am able to replicate your results using netcdf4. >>> >>> FYI, I don't believe the xml file is a CDAT creation; rather, it is >>> probably written using CMOR (http://www2-pcmdi.llnl.gov/cmor), which >>> was used to standardize the IPCC model output files, presumably so >>> they could be accessed by a variety of applications via OpenDAP. >>> H... >>> >>> At any rate, I can access the remote data object with netcdf4, but >>> no luck retrieving either data or a time index. >>> >>> In [94]: datobj = ncf(fname) >>> In [95]: timedata = datobj.variables['time'] >>> In [97]: taxvals = timedata[1070:1090] >>> In [99]: print taxvals >>> [ 32559.5 32590. 32620.5 32651. 32681.5 32712.5 32743. >>> 32773.5 >>> 32804. 32834.5 32865.5 32895. 32924.5 32955. 32985.5 33016. >>> 33046.5 33077.5 33108. 33138.5] >>> In [100]: print >>> date2index(date0,timedata.units,timedata.calendar,select='nearest') >> >> Arthur: That's because the timedata variable has no attributes (no >> calendar or units), and the date2index function looks for these >> attributes. That's weird though, since that dataset is supposed to >> be CF compliant. I wonder if openDAP is not handling that xml file >> correctly. >> >> -Jeff >>> --- >>> >>> AttributeErrorTraceback (most recent >>> call last) >>> >>> /home/amg/work/nhmm/ in () >>> >>> /home/amg/us
[Matplotlib-users] installing matplotlib 0.99 for pyhton 2.6 mac osx 10.5
Dear all, i have python 2.6 running on my mac osx 10.5, however when installing the binary file provided, it says i need to have python 2.6 on my machine. i dont understand why this is happening as when open a new terminal and type 'python', python version 2.6.2 is the version that is run. My supervisor also had a look at this and could not figure it out. He linked python 2.6 with the python command but the install file still did not recognise python 2.6. anybody have the same issue? or know of how to fix this issue? Thank You Farhan -- Academic Excellence at the Heart of Scotland. The University of Stirling is a charity registered in Scotland, number SC 011159. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] segfault on plot
I upgraded my numpy to 1.4.0.dev7375 and scipy to 0.8.0.dev5920. After doing so I get a segfault upon calling the plot command (see below) I guess I need to compile from source but I'm not sure exactly how to do so - are there any good step-by-step instructions out there? Thanks, Dave Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.10 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. *** Pasting of code with ">>>" or "..." has been enabled. In [2]: from numpy import * In [3]: from pylab import * In [4]: import numpy; numpy.__version__ Out[4]: '1.4.0.dev7375' In [5]: plot(randn(100)) C:\dev\bin\pythonxy\console> -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Can matplotlib generate charts like this?
Hi all, Can matplotlib (or any other Python charting library) generate charts like this: (also attached if you prefer) http://imagebin.ca/view/iGhEQEE.html It's basically a moving average with the vertical lines being the difference between the average and the actual data point. Can anyone send me in the right direction? Thanks! Erik <>-- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] creating mesh data from xyz data
Hi Giuseppe, As far as I understand you are looking for numpy.meshgrid, e.g. # grid in x- direction x = np.linspace(0, 1, 10) # grid in y-direction y = np.arange(5) # generate 2D-vectors out of x and y x, y = np.meshgrid(x, y) print np.shape(x) print np.shape(y) Furthermore you have to reshape your z-data accordingly, e.g. z = np.reshape(z, np.shape(x)) or transposed ... this depends on the storage of your data kind regards Matthias On Wednesday 09 September 2009 12:02:31 Giuseppe Aprea wrote: > Hi list, > > I have some files with data stored in columns: > > x1 y1 z1 > x2 y2 z2 > x3 y3 z3 > x4 y4 z4 > x5 y5 z5 > ... > > and I need to make a contour plot of this data using matplotlib. The > problem is that contour plot functions usually handle a different kind > of input: > > X=[[x1,x2,x3,x4,x5,x6], > [x1,x2,x3,x4,x5,x6], > [x1,x2,x3,x4,x5,x6],... > > Y=[[y1,y1,y1,y1,y1,y1], > [y2,y2,y2,y2,y2,y2], > [y3,y3,y3,y3,y3,y3],. > > Z=[[z1,z2,z3,z4,z5,z6], > [z7,z8,zz9,z10,z11,z12], > > I usually load data using 3 lists: x, y and z; I wonder if there is > any function which is able to take these 3 lists and return the right > input for matplotlib functions. > > cheers > > giuseppe > -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can matplotlib generate charts like this?
Erik Wickstrom schrieb: > Hi all, > > Can matplotlib (or any other Python charting library) generate charts > like this: (also attached if you prefer) Here is a demo-script. The second way is inspired by matlab. Can this be done more easily in python? Can X and Y be built more elegantly with numpy? Armin ---8< from pylab import * # data generation x = linspace(0,10,100) y = exp(-x) ye = y + rand(y.size)-0.5 # plot the vertical lines # with loop for xl,yl,yel in zip(x,y,ye): plot([xl,xl],[yl,yel],'r') plot(x,y,x,ye,'d') # plot by separating with NaN figure() X = zeros((x.size,3)) Y = zeros((x.size,3)) X[:,0],X[:,1],X[:,2] = x,x,NaN Y[:,0],Y[:,1],Y[:,2] = y,ye,NaN plot(X.flatten(),Y.flatten(),x,y,x,ye,'d') show() ---8< -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mpl 0.99 and py2exe
Jouni K. Seppänen wrote: > "Werner F. Bruhin" writes: > > >>> I think this has been fixed on the trunk for good, by changing all >>> docstring modifications to use decorators (defined in docstring.py) that >>> check for nonexistent docstrings. The changes are perhaps too big to >>> apply on the 0.99 branch. >>> >>> >> As it is fixed in trunk is there a need/much use for a patch to 0.99? >> I.e. how far of is the next release which includes what ever is in >> trunk? >> > > I think John Hunter said somewhere that he plans to release 1.0 in a few > months, but software release schedules are notoriously difficult to > estimate, and with volunteer-driven open-source software even more so. I > think the answer depends on how many people use py2exe, about which I > have absolutely no idea. > I don't think it is worse a patch as the work around is very easy. I documented what is needed for a py2exe setup.py with mpl 0.99 on the py2exe site at the end of the following page http://www.py2exe.org/index.cgi/MatPlotLib . While doing this I noted one more problem if one uses backend_wx, the wxPython version check will always fail if py2exe'd. I added "if not hasattr(sys, 'frozen'):" on line 113 and indented lines 114 to 131. Hopefully someone could make this change for the next version of mpl. Werner -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can matplotlib generate charts like this?
Erik Wickstrom wrote: > Hi all, > > Can matplotlib (or any other Python charting library) generate charts > like this: (also attached if you prefer) > > http://imagebin.ca/view/iGhEQEE.html > > It's basically a moving average with the vertical lines being the > difference between the average and the actual data point. > > Can anyone send me in the right direction? > Can you adapt one of the examples here: http://matplotlib.sourceforge.net/examples/pylab_examples/errorbar_demo.html Jason -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installing matplotlib 0.99 for pyhton 2.6 mac osx 10.5
Farhan Sheikh wrote: > i have python 2.6 running on my mac osx 10.5, however when installing > the binary file provided, it says i need to have python 2.6 on my > machine. i dont understand why this is happening as when open a new > terminal and type 'python', python version 2.6.2 is the version that > is run. My supervisor also had a look at this and could not figure it > out. He linked python 2.6 with the python command but the install file > still did not recognise python 2.6. > > anybody have the same issue? or know of how to fix this issue? How did you install 2.6? The binary MPL installer is probably looking for the python.org 2.6, which would be in /Library/Frameworks/ If you are using a macports python, for instance, the installer wouldn't find it. "which python" at the command line might help clear this up. or: python -c "import sys; print sys.path" That will spew out a bunch of dirs, and where there are should tell you where your python is installed. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] installing matplotlib 0.99 for pyhton 2.6 mac osx 10.5
Farhan Sheikh wrote: > when i installed python 2.6, i installed it into the /usr/local/lib > folder maybe I wasn't clear -- the MPL installer it meant to be used with the binary from python.org. You want use the installer you get here: http://www.python.org/download/ > python -c "import sys; print sys.path" > > the results i got were: > > ['', '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', > '/usr/local/lib/python2.6/plat-darwin', > '/usr/local/lib/python2.6/plat-mac', > '/usr/local/lib/python2.6/plat-mac/lib-scriptpackages', > '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', > '/usr/local/lib/python2.6/lib-dynload', > '/usr/local/lib/python2.6/site-packages'] > > it seems like everything was downloaded to the correct directory. for a unix-style install into /usr/local. yes. But it is not the kind of install that the MPL binary is expecting. There are WAY TOO MANY ways to install python on OS-X, but the "standard" way is the one used by the installers found on python.org: It is called a "Framework Build", and is the "Mac" way to do things. People have their reasons for doing it other ways, but package distributors can only support so much, so the python.org way is the one generally supported. You can build MPL for your install it you want, it should be easy, except for the dependencies -- I'm not sure what those are anymore, but a little reading of the docs should tell you. Oh, and you'll end up having to build every other extension, too - wxPython, QT, PIL, ??? Without good reason, I'd just go with the python,org build. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Distorting X-axis on a barchart
Hello, I have a simple bar-chart seen at http://img40.imageshack.us/img40/4889/barchart.png What is the way to plot each bar equally spaced apart from eachother? Any simple way without defining custom ticks or manipulating the data? Homework season has just started here. Lots of matplotting to do... Thanks. -- Gökhan -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] segfault on plot
Dave wrote: > I upgraded my numpy to 1.4.0.dev7375 and scipy to 0.8.0.dev5920. After doing > so > I get a segfault upon calling the plot command (see below) > > I guess I need to compile from source but I'm not sure exactly how to do so - > are there any good step-by-step instructions out there? > > Thanks, > Dave > > Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] > Type "copyright", "credits" or "license" for more information. > > IPython 0.10 -- An enhanced Interactive Python. > ? -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help -> Python's own help system. > object? -> Details about 'object'. ?object also works, ?? prints more. > > > *** Pasting of code with ">>>" or "..." has been enabled. > > In [2]: from numpy import * > > In [3]: from pylab import * > > In [4]: import numpy; numpy.__version__ > Out[4]: '1.4.0.dev7375' > > In [5]: plot(randn(100)) What happens if you simply do x = randn(100) or plot([1,2,3,2,1]) ? My guess is that you are seeing a numpy installation problem, not a matplotlib problem (that is, I expect the first trial above to fail and the second to succeed), and that the problem may be that you did not delete the build directory before rebuilding numpy from source. Distutils often fails to rebuild components that need to be recompiled after a change to the source, so the build and install appear to work, but the resulting numpy (or matplotlib, for that matter) does not. Eric -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can matplotlib generate charts like this?
Erik Wickstrom wrote: > Hi all, > > Can matplotlib (or any other Python charting library) generate charts > like this: (also attached if you prefer) > > http://imagebin.ca/view/iGhEQEE.html > > It's basically a moving average with the vertical lines being the > difference between the average and the actual data point. It looks like what you need is a simple modification of the present stem plot: http://matplotlib.sourceforge.net/examples/pylab_examples/stem_plot.html For now, you may be able to use the source--the stem method of the Axes class in matplotlib/lib/matplotlib/axes.py--to come up with your own function to do the job. Longer term, you, I, or someone else, should add this capability to that method via a keyword argument giving the baseline as a constant, or as an array of points corresponding to the input x variable. Even more options are possible. Eric > > Can anyone send me in the right direction? > > Thanks! > > Erik > > > > > > > > -- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > > > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Distorting X-axis on a barchart
On Thu, Sep 10, 2009 at 2:29 PM, Gökhan Sever wrote: > Hello, > > I have a simple bar-chart seen at > http://img40.imageshack.us/img40/4889/barchart.png > > What is the way to plot each bar equally spaced apart from eachother? Any > simple way without defining custom ticks or manipulating the data? > > Homework season has just started here. Lots of matplotting to do... > > Thanks. > > -- > Gökhan > Self replying: See the resulting image at http://img9.imageshack.us/img9/145/barchart2.png I am thinking a keyword like "spacing" could be added to the bar(). If it is set true then an approach similar shown in the 2nd version might followed to equally space the bars instead of linear or log scaling. Any other ideas or a hidden keyword to achieve the same plotting? The code to produce both figures: import numpy as np import matplotlib.pyplot as plt # Load data diameters, numbers = np.loadtxt('lab1-data', dtype='int8', skiprows=1).T # 1st version --with linear spacing width = 1.0 plt.bar(diameters, numbers, width=width, align='edge') plt.axis(xmin=diameters.min()-2, xmax=diameters.max()+2) plt.xlabel("Diameter (mm)", fontsize=16) plt.ylabel("Number of washers (#)", fontsize=16) plt.xticks(diameters+width/2, diameters) plt.figure() # 2nd version --equal spacing zipped = zip(diameters, numbers) zipped.sort() # Unzipping diameters, numbers = zip(*zipped) width = 0.4 plt.bar(range(len(diameters)), numbers, width=width, align='edge') plt.xlabel("Diameter (mm)", fontsize=16) plt.ylabel("Number of washers (#)", fontsize=16) plt.xticks(np.arange(len(diameters))+width/2, diameters) plt.axis(xmin=-width/2, xmax=len(diameters)-width) plt.show() #Data Diameter(mm) Number 11 7 744 10 24 51 1 38 2 35 3 21 12 28 16 12 8 16 8 -- Gökhan -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] logarithmic colormaps for imshow
In mpl_toolkits.basemap there is a module cm. I have been using the cm.s3pcpn colormap for some plots which require logarithmic coloring. The cm.s3pcpn_l colormap is also available (apparently a linear version). I wanted to know whether there were any other logarithmic colormaps available... for example, I would like to use gist_rainbow or gist_ncar, but I haven't been able to so far using the example below. Suggestions? The relevant section of code is here: dmn = 0.1 dmx = 100 logspace = 10.**np.linspace(dmn, dmx, 100) clevs = logspace im = m.imshow(topodat,cmap=cm.s3pcpn,vmin=clevs[0],vmax=clevs[-1]) -- View this message in context: http://www.nabble.com/logarithmic-colormaps-for-imshow-tp25392480p25392480.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] logarithmic colormaps for imshow
John [H2O] wrote: > In mpl_toolkits.basemap there is a module cm. > > I have been using the cm.s3pcpn colormap for some plots which require > logarithmic coloring. The cm.s3pcpn_l colormap is also available (apparently > a linear version). > > I wanted to know whether there were any other logarithmic colormaps > available... for example, I would like to use gist_rainbow or gist_ncar, but > I haven't been able to so far using the example below. Suggestions? In addition to specifying the cmap, specify the norm as a LogNorm instance: from matplotlib.colors import LogNorm im = imshow( cmap=... , norm=LogNorm(vmin=clevs[0], vmax=clevs[-1])) Try something like that. Eric > > > The relevant section of code is here: > > dmn = 0.1 > dmx = 100 > logspace = 10.**np.linspace(dmn, dmx, 100) > clevs = logspace > im = m.imshow(topodat,cmap=cm.s3pcpn,vmin=clevs[0],vmax=clevs[-1]) -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Customizing yticks while log-scaled
Hello, A new plot and two questions: http://img16.imageshack.us/img16/1759/logbarchart.png 1-) How to get nicely formatted yticks while will represent my data range (in Ax10^5 fashion 10^x works perfect as a defaul however couldn't figure out how to do this with number times 10^x)? An interesting point is when log=True yticks has to be called with two arguments as in the code otherwise no ticks shown at all. 2-) This is about my ylabel, although I have mm^3 showing nicely for some reason the closing bracket tends to stay separately. How to fix this in the code? Thanks. ### BEGIN CODE http:/import numpy as np import matplotlib.pyplot as plt diameters = np.array([ 7, 10, 11, 12, 16, 21, 28, 35, 38, 51]) numbers = np.array([44, 24, 7, 8, 8, 12, 16, 3, 2, 1]) http:width = 1.0 volumes = 4./3*np.pi*(diameters/2)**3 plt.bar(diameters, volumes*numbers, width=width, align='edge', log=True) plt.axis(xmin=diameters.min()-2, xmax=diameters.max()+2, ymax =\ (volumes*numbers).max()+2) plt.xlabel("Diameter (mm)", fontsize=16) plt.ylabel(r"Number of washers x Volumes (# $mm^3$)", fontsize=16) plt.xticks(diameters+width/2, diameters) #plt.yticks(volumes*numbers, volumes*numbers) #plt.yticks(np.arange(100, 2*10**5+100, 4*10**4), np.arange(100, 2*10**5+100, 4*10**4)) plt.figure() width = 0.4 plt.bar(range(len(diameters)), volumes*numbers, width=width, align='edge') plt.xlabel("Diameter (mm)", fontsize=16) plt.ylabel(r"Number of washers x Volumes (# $mm^3$)", fontsize=16) plt.xticks(np.arange(len(diameters))+width/2, diameters) plt.axis(xmin=-width/2, xmax=len(diameters)-width) #plt.yticks(volumes*numbers) plt.title("Distribution Lab - Question 2", fontsize=18) plt.show() ### CODE ENDS -- Gökhan -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users