[Matplotlib-users] quiver with angles
Im a bit confused of how I should use the quiver plotting function. My data is 2D, a 512x512 data array, where every entry is an angle (polarimetry). I also have an array with the degree of polarization which would be nice to colour-code in to the arrows. So: How do I use my angles to control the direction of the arrows, and how do I get values to control the colour of the arrows? Cheers, Magnus -- View this message in context: http://www.nabble.com/quiver-with-angles-tp25397027p25397027.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] segfault on plot
Eric Firing efir...@... writes: 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) 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 I initially had problems with numpy/scipy as I forgot to delete the build directories. After doing so recompiling they both passed all tests (barring some known issues with windows arctan - http://article.gmane.org/gmane.comp.python.numeric.general/31967) x = randn(100) worked fine and returned expected results for .mean() and .std() the segfault only occurred upon calling the plot(x). I resolved the issue by compiling matplotlib from source on my windows box which I'm happy to report wasn't too difficult! It seems to work for my usual interactive use however it segfaults when running the tests :| http://pastebin.com/m5ee30885 HTH, Dave -- 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
Must be something about asking the right question... This works perfectly. For those interested, my code is now as: dmn = 0.1 dmx = 100 logspace = 10.**np.linspace(dmn, dmx, 100) clevs = logspace colmap = pyplot.get_cmap('gist_ncar') im = m.imshow(topodat,cmap=colmap,norm=LogNorm(vmin=clevs[0],vmax=clevs[-1])) ## CREATE COLORBAR ## make a copy of the image object ## use non normalized colormap im2 = copy.copy(im) im2.set_cmap(colmap) ## create new axis for colorbar. cax = pyplot.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes ## using im2, not im (hack to prevent colors from being ## too compressed at the low end on the colorbar - results ## from highly nonuniform colormap) pyplot.colorbar(im2, cax, format='%3.2g') # draw colorbar ## reset colorbar tick labels clabels = clevs[::10] clabels.append(clevs[-1]) cax.set_yticks(np.linspace(0,1,len(clabels))) cax.set_yticklabels(['%3.2g' % cl for cl in clabels]) ## make the original axes current again pyplot.axes(ax) -- View this message in context: http://www.nabble.com/logarithmic-colormaps-for-imshow-tp25392480p25397260.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
[Matplotlib-users] Barchart with dates on X-axis
Hi list, I need to plot a barchart with dates on X-axis and values on Y-axis. This barchart must show the presence or absence of some factors in a some time. I try to use the barchart_demo.py as example, but in my case (X-values are dates in datetime format) this not quite fit. I want to get something like attached example. Is this possible? Which type of graphs (hist, bar...) and how I need to use? Thanks, Alexander -- Alexander Bruy mailto: alexander.b...@gmail.com attachment: barchart_with_dates.png-- 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] Math text produces garbage output
Matplotlib's built-in mathematical expression parser produces garbage output for math text: http://img3.imageshack.us/img3/8194/matplotlibmathtext.png I'm using the distribution packages from Fedora 11. I guess there's an issue with the fonts on my system but I can't figure out how to proceed with pinpointing the issue. Regards, -- Kamran Riaz Khan. http://inspirated.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] Math text produces garbage output
Can you add verbose.level : debug-annoying to your ~/.matplotlib/matplotlibrc file and send us the output produced? FWIW, I just tested the matplotlib package on FC11 and it seems to work fine on my system, so it's possibly a configuration issue. You might want to try removing for font cache file in: ~/.matplotlib/fontList.cache Mike Kamran Riaz Khan wrote: Matplotlib's built-in mathematical expression parser produces garbage output for math text: http://img3.imageshack.us/img3/8194/matplotlibmathtext.png I'm using the distribution packages from Fedora 11. I guess there's an issue with the fonts on my system but I can't figure out how to proceed with pinpointing the issue. Regards, -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- 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] Math text produces garbage output
On 09/11/2009 07:28 PM, Michael Droettboom wrote: Can you add verbose.level : debug-annoying to your ~/.matplotlib/matplotlibrc file and send us the output produced? FWIW, I just tested the matplotlib package on FC11 and it seems to work fine on my system, so it's possibly a configuration issue. You might want to try removing for font cache file in: ~/.matplotlib/fontList.cache Thanks for the quick reply. I deleted the fontList.cache file and added verbose.level : debug-annoying to my matplobrc file. The next run of pyplot example gave me: http://pastebin.com/f6d783aec The plot didn't appear but I guess that's the default behavior of verbose level option. I removed the debug-annoying and reran the example which in turn gave me the same image output as before. Kamran Riaz Khan wrote: Matplotlib's built-in mathematical expression parser produces garbage output for math text: http://img3.imageshack.us/img3/8194/matplotlibmathtext.png I'm using the distribution packages from Fedora 11. I guess there's an issue with the fonts on my system but I can't figure out how to proceed with pinpointing the issue. -- Kamran Riaz Khan. http://inspirated.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
[Matplotlib-users] Documentation
Hi Where can I download current mpl documentation in HTML format? Because there is now way to build it under win32 -- 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 resolved the issue by compiling matplotlib from source on my windows box which I'm happy to report wasn't too difficult! It seems to work for my usual interactive use however it segfaults when running the tests :| http://pastebin.com/m5ee30885 Thanks for running this. To my knowledge, you're the first one to run the new test infrastructure on Windows, so congratulations. :) (I presume you erased the MPL/build directory before compiling to clear out any cruft in there.) Anyhow, I have no clue what's going on. Is there any way you can get a stack trace? And why do you say segfault -- did Windows pop up a dialog? What did it say? One of these days I will try to get a Windows buildslave for the MPL buildbot, -Andrew -- 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] Math text produces garbage output
The log doesn't show any actual plotting. Did you run the same example with debug-annoying turned on? Turning debugging on shouldn't change any behavior -- only output more debugging information to the console. Cheers, Mike Kamran Riaz Khan wrote: On 09/11/2009 07:28 PM, Michael Droettboom wrote: Can you add verbose.level : debug-annoying to your ~/.matplotlib/matplotlibrc file and send us the output produced? FWIW, I just tested the matplotlib package on FC11 and it seems to work fine on my system, so it's possibly a configuration issue. You might want to try removing for font cache file in: ~/.matplotlib/fontList.cache Thanks for the quick reply. I deleted the fontList.cache file and added verbose.level : debug-annoying to my matplobrc file. The next run of pyplot example gave me: http://pastebin.com/f6d783aec The plot didn't appear but I guess that's the default behavior of verbose level option. I removed the debug-annoying and reran the example which in turn gave me the same image output as before. Kamran Riaz Khan wrote: Matplotlib's built-in mathematical expression parser produces garbage output for math text: http://img3.imageshack.us/img3/8194/matplotlibmathtext.png I'm using the distribution packages from Fedora 11. I guess there's an issue with the fonts on my system but I can't figure out how to proceed with pinpointing the issue. -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- 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] adjusting width of subplot columns
hi all, i have a 3x2 subplot figure, and i would like to adjust the relative width of the second column. in other words, if i have: import matplotlib.pyplot as plt plt.subplot(3, 2, 1) # plot stuff plt.subplot(3, 2, 2) # plot, etc... i want to make it so the second column occupies less width in the figure than the first column. for example, i want the series of subplots in the first column to take up 70% of the figure, and the subplots in the second column to take up only 30%. is there a way to do this? i looked into plt.subplots_adjust but i do not know how to use that function to get this desired effect. thanks. -- 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] error bars getting cut off when plotting
hi all, i have the following simple plot using the 'errorbars' function. when i plot it, one of the error bars is cut off: from numpy import * from scipy import * from mpl_toolkits.axes_grid.axislines import SubplotZero fig = plt.figure() ax = SubplotZero(fig, 3, 2, 1) fig.add_subplot(ax) ax.axis[xzero].set_visible(True) for k in [bottom, top, right]: ax.axis[k].set_visible(False) m = array([0.83820351, 0.816858357]) sd = array([0.18543833, 0.12603507]) lw = 1.2 msize = 3 plt.errorbar([1, 2], m, yerr=sd, fmt='-s', markersize=msize, linewidth=lw) tm = .8 lower_y = max(tm-.2, 0) upper_y = min(tm+.4, 1) ytickvals = arange(lower_y, upper_y + .1, .1) plt.xlim([0, 3]) plt.yticks(ytickvals) plt.ylim([lower_y, upper_y]) plt.savefig('test.pdf') when i plot it, the top error bar of the first data point gets cut off. this error bar should be at location: 0.83820351+0.18543833 which slightly exceeds the ylimit of 1. since the y value here is a probability, i dont want the plot to have labels on it that exceed 1, since that does not make sense. is there any way to allow more room for the y axis without plotting values greater than 1? this is only for the purpose of errorbars. again, these data were just various probabilities, and so they never exceed 1. thanks. -- 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] quiver with angles
n.l.o wrote: Im a bit confused of how I should use the quiver plotting function. My data is 2D, a 512x512 data array, where every entry is an angle (polarimetry). I also have an array with the degree of polarization which would be nice to colour-code in to the arrows. So: How do I use my angles to control the direction of the arrows, and how do I get values to control the colour of the arrows? Cheers, Magnus Example with ipython -pylab: x = arange(4) y = arange(5) X, Y = meshgrid(x, y) u = ones_like(X) v = zeros_like(X) c = arange(u.size) # values mapped to colors angles = (X * 20 + Y * 20).ravel() quiver(X, Y, u, v, c, angles=angles) axis([-1, 4, -1, 5]) The .ravel() of the angles is to get around a bug that I fixed a few minutes ago in svn. 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
[Matplotlib-users] Little help needed with pqt ...
Hello, I face a very boring problem. Here is a little modified pyqt widget example found on matplotlib website. Basicaly I've just added a tab widget and inside it a matplotlib widget. Sadly, on creation the widget don't get the full size of the PA_tab widget :( BUT once I resize manually the app all became OK... To be honest I've got NO idea of what is the problem :( Any direction highly appreciated! Laurent matplotlib: __version__ = '0.98.5.2' And pyqt: 4.4.3.6 #!/usr/bin/env python # embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases # # Copyright (C) 2005 Florent Rougon # 2006 Darren Dale # # This file is an example program for matplotlib. It may be used and # modified with no restriction; raw copies as well as modified versions # may be distributed without limitation. import sys, os, random from PyQt4 import QtGui, QtCore from numpy import arange, sin, pi from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure progname = os.path.basename(sys.argv[0]) progversion = 0.1 class MyMplCanvas(FigureCanvas): Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.). def __init__(self, parent=None, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) self.axes = fig.add_subplot(111) # We want the axes cleared every time plot() is called self.axes.hold(False) self.compute_initial_figure() # FigureCanvas.__init__(self, fig) self.setParent(parent) FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) FigureCanvas.updateGeometry(self) def compute_initial_figure(self): pass class MyStaticMplCanvas(MyMplCanvas): Simple canvas with a sine plot. def compute_initial_figure(self): t = arange(0.0, 3.0, 0.01) s = sin(2*pi*t) self.axes.plot(t, s) class MyDynamicMplCanvas(MyMplCanvas): A canvas that updates itself every second with a new plot. def __init__(self, *args, **kwargs): MyMplCanvas.__init__(self, *args, **kwargs) timer = QtCore.QTimer(self) QtCore.QObject.connect(timer, QtCore.SIGNAL(timeout()), self.update_figure) timer.start(1000) def compute_initial_figure(self): self.axes.plot([0, 1, 2, 3], [1, 2, 0, 4], 'r') def update_figure(self): # Build a list of 4 random integers between 0 and 10 (both inclusive) l = [ random.randint(0, 10) for i in xrange(4) ] self.axes.plot([0, 1, 2, 3], l, 'r') self.draw() class ApplicationWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setWindowTitle(application main window) self.centralwidget = QtGui.QWidget(self) self.verticalLayout = QtGui.QVBoxLayout(self.centralwidget) self.MainTab = QtGui.QTabWidget(self.centralwidget) self.verticalLayout.addWidget(self.MainTab) self.PA_tab = QtGui.QWidget() self.MainTab.addTab(self.PA_tab, ) toto = MyDynamicMplCanvas(self.PA_tab) self.vLayout = QtGui.QVBoxLayout(self.PA_tab) self.vLayout.addWidget(toto) self.setCentralWidget(self.centralwidget) self.resize(QtCore.QSize(1024,900)) def fileQuit(self): self.close() def closeEvent(self, ce): self.fileQuit() def about(self): QtGui.QMessageBox.about(self, About %s % progname, u%(prog)s version %(version)s Copyright \N{COPYRIGHT SIGN} 2005 Florent Rougon, 2006 Darren Dale This program is a simple example of a Qt4 application embedding matplotlib canvases. It may be used and modified with no restriction; raw copies as well as modified versions may be distributed without limitation. % {prog: progname, version: progversion}) qApp = QtGui.QApplication(sys.argv) aw = ApplicationWindow() aw.setWindowTitle(%s % progname) aw.show() sys.exit(qApp.exec_()) #qApp.exec_() -- 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] Re :Re: Little help need ed with pqt ...
Hi Darren, Thanks for your answer. ... I've updated to matplotlib 0.99 since the last email... and the bug disappeared :) Must be a bug of previous version since I had ever added a layout to the central widget! Thanks anyway for your help! On Fri, Sep 11, 2009 at 5:52 PM, Laurent Dufrechou laurent.dufrec...@gmail.com wrote: Hello, I face a very boring problem. Here is a little modified pyqt widget example found on matplotlib website. Basicaly I've just added a tab widget and inside it a matplotlib widget. Sadly, on creation the widget don't get the full size of the PA_tab widget :( BUT once I resize manually the app all became OK... To be honest I've got NO idea of what is the problem :( Any direction highly appreciated! Try adding a layout to the central widget and adding your tab widget to that layout. Darren -- 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] Re :Re: Little help needed with pqt ...
I think this was fixed in 0.99 by the removal of a call to processEvents, which was causing segfaults in other contexts. On Fri, Sep 11, 2009 at 6:32 PM, laurent.dufrec...@gmail.com wrote: Hi Darren, Thanks for your answer. ... I've updated to matplotlib 0.99 since the last email... and the bug disappeared :) Must be a bug of previous version since I had ever added a layout to the central widget! Thanks anyway for your help! On Fri, Sep 11, 2009 at 5:52 PM, Laurent Dufrechou laurent.dufrec...@gmail.com wrote: Hello, I face a very boring problem. Here is a little modified pyqt widget example found on matplotlib website. Basicaly I've just added a tab widget and inside it a matplotlib widget. Sadly, on creation the widget don't get the full size of the PA_tab widget :( BUT once I resize manually the app all became OK... To be honest I've got NO idea of what is the problem :( Any direction highly appreciated! Try adding a layout to the central widget and adding your tab widget to that layout. Darren -- 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 -- In our description of nature, the purpose is not to disclose the real essence of the phenomena but only to track down, so far as it is possible, relations between the manifold aspects of our experience - Niels Bohr It is a bad habit of physicists to take their most successful abstractions to be real properties of our world. - N. David Mermin Once we have granted that any physical theory is essentially only a model for the world of experience, we must renounce all hope of finding anything like the correct theory ... simply because the totality of experience is never accessible to us. - Hugh Everett III -- 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] plt.gray dont' work with plt.scatter?
Hello, Sorry for my broken english. I copy the source code from http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_demo.html Just Insert one line gray() before the last line show(). But the picture is sitll colorful. not a gray picture. It there somethig I missed. Thanks in advance. bar.py Description: Binary data -- 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