[Matplotlib-users] hist is broken in SVN when using numpy 1.1.0.dev5077
Hello, I am using r5186 from the SVN with numpy 1.1.0.dev5077. When I try hist(rand(512),arange(-128,127)) I get: --- Traceback (most recent call last) /home/gej/casper_work/backend/qtSpec/src/ in () /usr/lib/python2.5/site-packages/matplotlib/pyplot.py in hist(*args, **kwargs) 1688 hold(h) 1689 try: -> 1690 ret = gca().hist(*args, **kwargs) 1691 draw_if_interactive() 1692 except: /usr/lib/python2.5/site-packages/matplotlib/axes.py in hist(self, x, bins, normed, cumulative, bottom, histtype, align, orientation, width, log, **kwargs) 5472 if not self._hold: self.cla() 5473 n, bins = np.histogram(x, bins, range=None, -> 5474 normed=bool(normed), new=True) 5475 5476 if cumulative: : histogram() got an unexpected keyword argument 'new' I guess the new keyword argument has been deprecated? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Bug with blitting in Qt4Agg backend
Hello, I am experiencing a bug when trying to blit a canvas that contains two axes, one with a line plot and the other with an imshow plot. The attached example, QtBlitBugDemo.py demonstrates the problem. As is, on my machine, the imshow plot updates correctly, but the line plot acts like the background is not being restored correctly, the lines keep piling up on top of each other, even though I am explicitly restoring a clean background before drawing the artist. If I simply comment out the line: self.specPlotB.draw_artist(self.specArtistB) which draws the imshow artist, the line plot behaves correctly. I haven't been able to figure out what is causing this behavior. I am using r5186 from the SVN. The output from running with debug mode on is below. Thanks for any help on this. Glenn matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data loaded rc file /home/glenn/.matplotlib/matplotlibrc matplotlib version 0.98pre verbose.level debug interactive is False units is True platform is linux2 loaded modules: ['numpy.lib.pkgutil', 'numpy.lib.tempfile', 'numpy.ma.types', 'xml.sax.urlparse', 'distutils', 'matplotlib.errno', 'matplotlib.matplotlib', '_bisect', 'numpy.core.defchararray', 'pprint', 'numpy.lib.bz2', 'matplotlib.tempfile', 'distutils.sysconfig', 'ctypes._endian', 'encodings.encodings', 'matplotlib.colors', 'numpy.core.numerictypes', 'numpy.testing.sys', 'numpy.core.info', 'xml', 'numpy.fft.types', 'numpy.ma.operator', 'numpy.ma.cPickle', 'struct', 'numpy.random.info', 'tempfile', 'mmap', 'xml.sax.urllib', 'numpy.linalg', 'numpy.testing.operator', 'imp', 'compiler.sys', 'collections', 'compiler.pyassem', 'numpy.core.umath', '_struct', 'unittest', 'compiler.new', 'numpy.lib.numpy', 'numpy.testing.types', 'compiler.ast', 'numpy.ma.sys', 'zipimport', 'string', 'numpy.testing.os', 'matplotlib.locale', 'numpy.lib.arraysetops', 'numpy.testing.unittest', 'numpy.lib.inspect', 'encodings.utf_8', 'matplotlib.__future__', 'numpy.linalg.numpy', 'pytz.tzinfo', 'numpy.ctypeslib', 'numpy.testing.re', 'itertools', 'numpy.version', 'numpy.lib.re', 'distutils.re', 'ctypes.os', 'compiler.token', 'numpy.core.os', 'compiler', 'numpy.lib.type_check', 'httplib', 'bisect', 'signal', 'compiler.consts', 'numpy.lib._datasource', 'random', 'numpy.ma.extras', 'token', 'numpy.fft.fftpack_lite', 'shlex', 'ctypes.ctypes', 'xml.sax.xmlreader', 'matplotlib.pytz', 'numpy.__builtin__', 'numpy.testing.shlex', 'dis', 'pytz.tzfile', 'cStringIO', 'zlib', 'numpy.numpy', 'matplotlib.StringIO', 'locale', 'numpy.add_newdocs', 'numpy.lib.getlimits', 'PyQt4', 'compiler.transformer', 'xml.sax.saxutils', 'compiler.struct', 'pkgutil', 'compiler.parser', 'numpy.lib.sys', 'encodings', 'compiler.symbol', 'numpy.lib.io', 'numpy.ma.itertools', 'StringIO', 'dateutil', 'pydoc', 'pytz.cStringIO', 'numpy.imp', 'numpy.ctypes', 'matplotlib.warnings', 'rfc822', 'matplotlib.string', 'pytz.pytz', 'urllib', 'matplotlib.sys', 're', 'numpy.lib._compiled_base', 'numpy.core.mmap', 'new', 'numpy.lib.struct', 'symbol', 'math', 'numpy.fft.helper', 'fcntl', 'numpy.ma.warnings', 'compiler.imp', 'UserDict', 'inspect', 'distutils.os', 'matplotlib', 'urllib2', 'pytz.os', 'fnmatch', 'numpy.lib.info', 'numpy.testing', 'numpy.testing.glob', 'numpy.lib.warnings', 'ctypes.struct', 'codecs', 'numpy.core._sort', 'PyQt4.QtGui', 'compiler.visitor', 'md5', '_locale', 'matplotlib.sre_constants', 'matplotlib.os', 'thread', 'numpy.lib.ufunclike', 'numpy.core.memmap', 'traceback', 'numpy.core._dotblas', 'numpy.testing.warnings', 'weakref', 'numpy.core._internal', 'numpy.fft.fftpack', 'opcode', 'numpy.core.scalarmath', 'numpy.linalg.lapack_lite', 'ctypes', 'distutils.sys', 'os', 'marshal', 'numpy.lib.shutil', '__future__', 'numpy.core.string', 'matplotlib.copy', 'xml.sax.types', 'numpy.random.numpy', '_sre', 'numpy.lib.gzip', 'numpy.core.sys', 'numpy.random', 'numpy.testing.utils', '__builtin__', 'numpy.lib.twodim_base', 'numpy.ma.core', 'matplotlib.re', 'numpy.core.cPickle', 'base64', 'compiler.dis', 'operator', 'numpy.testing.parametric', 'numpy.core.arrayprint', 'distutils.string', 'ctypes._ctypes', '_heapq', 'ctypes.sys', 'heapq', 'numpy.os', 'posixpath', 'numpy.lib.financial', 'numpy.core.multiarray', 'errno', 'numpy.testing.numpy', '_socket', 'binascii', 'numpy.lib.compiler', 'sre_constants', 'compiler.cStringIO', 'datetime', 'compiler.os', 'matplotlib.md5', 'types', 'pytz.sys', 'tokenize', 'FigureWindow', 'xml.sax.handler', 'numpy.core.numpy', 'numpy', 'numpy.lib.urlparse', 'matplotlib.dateutil', 'numpy.core.defmatrix', 'xml.sax.os', 'cPickle', 'matplotlib.xml', '_codecs', 'numpy.testing.difflib', 'matplotlib.traceback', 'numpy.__config__', 'numpy.fft.info', 'numpy.lib.types', 'pytz', 'matplotlib.pyparsing', 'compiler.copy_reg', 'numpy.ma.numpy', 'copy', 'numpy.core.re', 'socket', '_types', 'numpy.core.fromnumeric', 'hashlib', 'compiler.future', 'matplotlib.cbook', 'numpy.core.copy_reg', 'numpy.lib.scimath', 'numpy.fft', 'numpy.lib', '_ctypes', 'apport_pyth
Re: [Matplotlib-users] hist is broken in SVN when using numpy 1.1.0.dev5077
Hi Glenn, I do not reproduce your problem with current revisions of numpy and matplotlib. best, Johann G Jones wrote: > Hello, > I am using r5186 from the SVN with numpy 1.1.0.dev5077. When I try > hist(rand(512),arange(-128,127)) > I get: > --- > Traceback (most recent call last) > > /home/gej/casper_work/backend/qtSpec/src/ in () > > /usr/lib/python2.5/site-packages/matplotlib/pyplot.py in hist(*args, **kwargs) >1688 hold(h) >1689 try: > -> 1690 ret = gca().hist(*args, **kwargs) >1691 draw_if_interactive() >1692 except: > > /usr/lib/python2.5/site-packages/matplotlib/axes.py in hist(self, x, > bins, normed, cumulative, bottom, histtype, align, orientation, width, > log, **kwargs) >5472 if not self._hold: self.cla() >5473 n, bins = np.histogram(x, bins, range=None, > -> 5474 normed=bool(normed), new=True) >5475 >5476 if cumulative: > > : histogram() got an unexpected keyword > argument 'new' > > I guess the new keyword argument has been deprecated? > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] hist is broken in SVN when using numpy 1.1.0.dev5077
Hi Glenn, please update numpy!!! Indeed, it is the other way around: The "new" keyword-arg isn't deprecated it is *NEW* (has been added in numpy revision r5085, you are using r5077). Have a look at this: http://projects.scipy.org/scipy/numpy/roadmap#Semanticchangeforhistogram Please note that this also means a change in the semantic of the matplotlib hist API, see API_CHANGES. Manuel G Jones wrote: > Hello, > I am using r5186 from the SVN with numpy 1.1.0.dev5077. When I try > hist(rand(512),arange(-128,127)) > I get: > --- > Traceback (most recent call last) > > /home/gej/casper_work/backend/qtSpec/src/ in () > > /usr/lib/python2.5/site-packages/matplotlib/pyplot.py in hist(*args, **kwargs) >1688 hold(h) >1689 try: > -> 1690 ret = gca().hist(*args, **kwargs) >1691 draw_if_interactive() >1692 except: > > /usr/lib/python2.5/site-packages/matplotlib/axes.py in hist(self, x, > bins, normed, cumulative, bottom, histtype, align, orientation, width, > log, **kwargs) >5472 if not self._hold: self.cla() >5473 n, bins = np.histogram(x, bins, range=None, > -> 5474 normed=bool(normed), new=True) >5475 >5476 if cumulative: > > : histogram() got an unexpected keyword > argument 'new' > > I guess the new keyword argument has been deprecated? > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Help sending a PNG from matplotlib to stdout
From: John Hunter [mailto:[EMAIL PROTECTED] Sent: Saturday, May 17, 2008 4:56 PM> I believe this has been fixed on the maintenance branch (which will > become 0.91.3 shortly after the next release). You can get a svn > > checkout of this branch at > > svn co > https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_ > 91_maint > mpl91 Great, I got the files through svn. I have the Enthought version of python installed (2.5.2) with all the packages that come with enstall. Would you please point me in the right direction for getting matplotlib built and installed? I brought the files down to c:\mpl91. So, I opened a command prompt in windows and navigated to that folder. Then I typed: setup.py build During the build process it gave me some errors. Below I have pasted the output from the above call. Do I need vs2003 installed on my box? BUILDING MATPLOTLIB matplotlib: 0.91.2svn python: 2.5.2 |EPD 2.5.2001| (release25-maint:60919M, Feb 21 2008, 10:31:43) [MSC v.1310 32 bit (Intel)] platform: win32 Windows version: (5, 1, 2600, 2, 'Service Pack 2') REQUIRED DEPENDENCIES numpy: 1.0.4 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '.', '.\freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of '.' Tkinter: no * Tkinter present, but header files are not found. * You may need to install development packages. wxPython: 2.8.4.0 * WxAgg extension not required for wxPython >= 2.8 Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: 1.3 pytz: 2006p OPTIONAL USETEX DEPENDENCIES dvipng: file. ghostscript: 'gswin32c' is not recognized as an internal or external command, operable program or batch file. latex: no EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES configobj: 4.5.1 enthought.traits: 2.0.4 [Edit setup.cfg to suppress the above messages] running build running build_py copying lib\matplotlib\mpl-data\matplotlibrc -> build\lib.win32-2.5\matplotlib\mpl-data copying lib\matplotlib\mpl-data\matplotlib.conf -> build\lib.win32-2.5\matplotlib\mpl-data running build_ext No module named msvccompiler in numpy.distutils; trying from distutils error: Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32, by passing "-c mingw32" to setup.py. Thanks -Rodney - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Help sending a PNG from matplotlib to stdout
John Hunter wrote: > On Sat, May 17, 2008 at 3:49 PM, Rodney Haynie <[EMAIL PROTECTED]> wrote: > > >> "C:\Python25\lib\site-packages\matplotlib-0.91.2.0001-py2.5-win32.egg\matplo >> tlib\backends\backend_agg.py", line 397, in print_png >>self.get_renderer()._renderer.write_png(str(filename), >> self.figure.dpi.get()) >> RuntimeError: Could not open file ', mode 'w' at >> 0x00A0F068> >> > > I believe this has been fixed on the maintenance branch (which will > become 0.91.3 shortly after the next release). You can get a svn > checkout of this branch at > > svn co > https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint > mpl91 > > Michael, I notice in the code we have: > > if type(filename_or_obj) in (str, unicode): > filename_or_obj = open(filename_or_obj, 'w') > > is there any reason not to use cbook.is_string_like here, which should > be more general? > I don't think so. Probably just an oversight on my part. I'll correct it. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Help sending a PNG from matplotlib to stdout
Rodney Haynie wrote: > From: John Hunter [mailto:[EMAIL PROTECTED] > Sent: Saturday, May 17, 2008 4:56 PM> I believe this has been fixed on the > maintenance branch (which will > >> become 0.91.3 shortly after the next release). You can get a svn > >> checkout of this branch at >> >> svn co >> https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_ >> 91_maint >> mpl91 >> > > > Great, I got the files through svn. > I have the Enthought version of python installed (2.5.2) with all the > packages that come with enstall. > > Would you please point me in the right direction for getting matplotlib > built and installed? > > I brought the files down to c:\mpl91. > > So, I opened a command prompt in windows and navigated to that folder. > > Then I typed: setup.py build > > During the build process it gave me some errors. Below I have pasted the > output from the above call. Do I need vs2003 installed on my box? No, but you do need a compiler supported by Python's distutils. If you want to use a non-Microsoft compiler, you have to explicitly say so when you invoke setup.py with the "--compiler" flag. I personally have had success with mingw32. Once you have that installed and setup, there are additional Windows build instructions at the top of setupext.py. Let us know how you progress. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug with blitting in Qt4Agg backend
On Monday 19 May 2008 03:36:01 am G Jones wrote: > Hello, > I am experiencing a bug when trying to blit a canvas that contains two > axes, one with a line plot and the other with an imshow plot. The > attached example, QtBlitBugDemo.py demonstrates the problem. As is, on > my machine, the > imshow plot updates correctly, but the line plot acts like the > background is not being restored correctly, the lines keep piling up > on top of each other, even though I am explicitly restoring a clean > background before drawing the artist. If I simply comment out the > line: >self.specPlotB.draw_artist(self.specArtistB) > which draws the imshow artist, the line plot behaves correctly. > I haven't been able to figure out what is causing this behavior. > I am using r5186 from the SVN. The output from running with debug mode > on is below. I'm not convinced this is a bug in matplotlib. The following example works: import matplotlib matplotlib.use('qt4agg') from matplotlib import widgets from matplotlib import pyplot as plt import numpy as np ax=plt.axes() cursor = widgets.Cursor(ax, useblit=True) ax.imshow(np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]), cmap=plt.cm.jet, interpolation='nearest') plt.show() I can't follow your example. It would be better to submit a single script with as simple an example as possible that illustrates the problem. Maybe you could have a look at matplotlib.widgets.Cursor to get some ideas of how to structure your code. Darren - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] choose line color with plot?
Hello: I want to plot a variable number of lines but I would like the colors to cycle through a set pattern defined by me. I use this when working with line collections. colors = [colorConverter.to_rgba(c) for c in [('k','y','m','c','b','g','r')] line = collections.LineCollection( ... line.set_color(colors) and it works great. But I need legends for each line so I can't use collections. I would like to choose the colors and loop over a list if the lines exceed the colors while using plot. Any ideas? - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug with blitting in Qt4Agg backend
On Mon, May 19, 2008 at 2:36 AM, G Jones <[EMAIL PROTECTED]> wrote: > Hello, > I am experiencing a bug when trying to blit a canvas that contains two > axes, one with a line plot and the other with an imshow plot. The > attached example, QtBlitBugDemo.py demonstrates the problem. As is, on > my machine, the > imshow plot updates correctly, but the line plot acts like the > background is not being restored correctly, the lines keep piling up > on top of each other, even though I am explicitly restoring a clean > background before drawing the artist. If I simply comment out the > line: > self.specPlotB.draw_artist(self.specArtistB) > which draws the imshow artist, the line plot behaves correctly. > I haven't been able to figure out what is causing this behavior. > I am using r5186 from the SVN. The output from running with debug mode > on is below. I don't have qt installed so I can't test this here, but poking through the code one thing looks badly wrong (though it may be unrelated to your problem) if self.autoSpec: self.specPlotT.relim() self.specPlotT.autoscale_view(scalex = False, scaley = True) you cannot change the viewlim when updating your animated artists (nor should you change the grid). The idea is - draw (everything but animated by default) -- copy the background start animation loop: * restore background * update *only* your animated artists and change nothing else about the figure (viewlim, grid, labels, etc) * draw your animated artists * blit If you need to change anything else, you need to invoke a draw, then a copy a new background, and then proceed through the animation loop. Also, be aware that zorder is not respected for animated artists, so I think you will want to update and draw your image before the lines. JDH - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] choose line color with plot?
On Mon, May 19, 2008 at 8:38 AM, Zoho Vignochi <[EMAIL PROTECTED]> wrote: > Hello: > > I want to plot a variable number of lines but I would like the colors to > cycle through a set pattern defined by me. > ...snip > and it works great. But I need legends for each line so I can't use > collections. I would like to choose the colors and loop over a list if > the lines exceed the colors while using plot. Any ideas? You can override the default color cycle: import matplotlib.axes matplotlib.axes._process_plot_var_args.defaultColors = [k','y','m','c','b','g','r'] We should remove the leading underscore in the _process_plot_var_args since it indicates users should not be working with it, but customizing the color cycle is perfectly legit. JDH - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Record array help
Hi, [I've also asked this on scipy-user, but since 'csv2rec' is a pylab function which is not part of NumPy, I thought maybe someone here can give me some pointers...] Is there any extended documentation/tutorial on record arrays? The NumPy book is pretty cryptic about this and I'm still very new to the concept. I'm using the csv2rec function from matplotlib (pylab) to generate a record array from data that's in a CSV file. The CSV file basically has column labels in the first row and numerical data in all subsequent rows. The issues I'm struggling with are: 1. Is it possible to change the dtype of a field after the record array has been created? 2. The CSV file has missing data points - how do I turn these into python 'None' elements in the record array? (If I leave that element empty in the CSV file, then csv2rec complains about not being able to handle the import; if I put 'None' in the CSV file (without quotes), then the whole field including the 'None' and all the other float data is converted into a string dtype, rendering the numerical data useless). 3. Is it possible to obtain a subset of the original data (corresponding to two or more columns of the CSV file) as a conventional 2D numpy array, or can I access the data only individually by column (i.e. field in the record array)? Any pointers would be appreciated! Johann - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bug with blitting in Qt4Agg backend
On 5/19/08, John Hunter <[EMAIL PROTECTED]> wrote: > On Mon, May 19, 2008 at 2:36 AM, G Jones <[EMAIL PROTECTED]> wrote: > > Hello, > > I am experiencing a bug when trying to blit a canvas that contains two > > axes, one with a line plot and the other with an imshow plot. The > > attached example, QtBlitBugDemo.py demonstrates the problem. As is, on > > my machine, the > > imshow plot updates correctly, but the line plot acts like the > > background is not being restored correctly, the lines keep piling up > > on top of each other, even though I am explicitly restoring a clean > > background before drawing the artist. If I simply comment out the > > line: > > self.specPlotB.draw_artist(self.specArtistB) > > which draws the imshow artist, the line plot behaves correctly. > > I haven't been able to figure out what is causing this behavior. > > I am using r5186 from the SVN. The output from running with debug mode > > on is below. > > > I don't have qt installed so I can't test this here, but poking > through the code one thing looks badly wrong (though it may be > unrelated to your problem) > > if self.autoSpec: > self.specPlotT.relim() > self.specPlotT.autoscale_view(scalex = False, scaley = True) > > you cannot change the viewlim when updating your animated artists (nor > should you change the grid). The idea is > > > > - draw (everything but animated by default) > > > -- copy the background > > start animation loop: > > * restore background > > * update *only* your animated artists and change nothing else > about the figure (viewlim, grid, labels, etc) > > * draw your animated artists > > * blit > > If you need to change anything else, you need to invoke a draw, then a > copy a new background, and then proceed through the animation loop. > Also, be aware that zorder is not respected for animated artists, so I > think you will want to update and draw your image before the lines. > > JDH > Thank you for the notes. I found that if I draw the image before the line, it works as expected. Even though you say I shouldn't try to change the viewlim when blitting, this does seem to work, the plot stays within bounds. The axes do not display the correct values until I resize the window (which forces a full redraw), but I can live with that. However, I am curious how one should achieve dynamic autoscaling while doing an animated plot. Doing a full draw each iteration is too slow. Is there any other way? Thanks again, Glenn - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] choose line color with plot?
John Hunter wrote: > On Mon, May 19, 2008 at 8:38 AM, Zoho Vignochi <[EMAIL PROTECTED]> wrote: >> Hello: >> >> I want to plot a variable number of lines but I would like the colors to >> cycle through a set pattern defined by me. >> ...snip >> and it works great. But I need legends for each line so I can't use >> collections. I would like to choose the colors and loop over a list if >> the lines exceed the colors while using plot. Any ideas? > > You can override the default color cycle: > > import matplotlib.axes > > matplotlib.axes._process_plot_var_args.defaultColors = > [k','y','m','c','b','g','r'] > > We should remove the leading underscore in the _process_plot_var_args > since it indicates users should not be working with it, but > customizing the color cycle is perfectly legit. True, but from the standpoint of user interface design this may not be a good way to do it. At the very least, shouldn't there be a more concise variable or function? _process_plot_var_args really deserves its leading underscore. We could use something like an axes-level function, "set_color_cycle(clist)" to encapsulate what you suggest above. Eric - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Adding labels to plots does not work
In a recent SVN build of matplotlib on OSX 10.5, I have created a boxplot then tried to add labels to the axes afterwards. However, though the "xlabel" and "ylabel" commands run without error, no labels are added to the plots. In [45]: boxplot(transpose(transpose(relative_risk.trace())[:-2])) In [46]: xlabel=("Option") In [47]: ylabel=("Risk Reduction") - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Adding labels to plots does not work
On Mon, May 19, 2008 at 6:07 PM, Chris <[EMAIL PROTECTED]> wrote: > In a recent SVN build of matplotlib on OSX 10.5, I have created a boxplot > then tried to add labels to the axes afterwards. However, though the "xlabel" > and "ylabel" commands run without error, no labels are added to the plots. > > In [45]: boxplot(transpose(transpose(relative_risk.trace())[:-2])) > > In [46]: xlabel=("Option") > > In [47]: ylabel=("Risk Reduction") There shouldn't be an "=" sign in lines 46 and 47. The correct syntax is xlabel("Option") ylabel("Risk Reduction") Your example code is assigning a string to the local variables xlabel and ylabel, but is not calling the pylab functions xlabel and ylabel. JDH - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Png stream through Stdout to the web
I could not find anywhere an example of exactly how I would call the py script and get the png to appear in a web page. I have py scripts working for cgi, which is great. So I placed my simple script in the cgi-bin folder and I tried calling it directly: Localhost/cgi-bin/stdoutTest.py No image file shows up. So, I gathered I should refer to the location like any other graphic file. So I made a test html file and put an image tag and set the src attribute. http://localhost/cgi-bin/stdout.py";> I then called the html file: Localhost/pngTest.html Still no image appears. Lastly, if I call stdout.py from the command prompt, then I will see the stream of data that makes up the png image. So at least I am no longer getting the traceback error. Does anyone try to show their graphs without actually saving the png file? Any help would be greatly appreciated. -Rodney - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Png stream through Stdout to the web
Sorry, my file name is stdout.py, in both places. And here it is: #!c:/Python25/python.exe -u import sys import matplotlib matplotlib.use('Agg') from pylab import * plot ([1 ,2 ,3]) savefig( sys.stdout ) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rodney Haynie Sent: Monday, May 19, 2008 10:10 PM To: matplotlib-users@lists.sourceforge.net Subject: [Matplotlib-users] Png stream through Stdout to the web I could not find anywhere an example of exactly how I would call the py script and get the png to appear in a web page. I have py scripts working for cgi, which is great. So I placed my simple script in the cgi-bin folder and I tried calling it directly: Localhost/cgi-bin/stdoutTest.py No image file shows up. So, I gathered I should refer to the location like any other graphic file. So I made a test html file and put an image tag and set the src attribute. http://localhost/cgi-bin/stdout.py";> I then called the html file: Localhost/pngTest.html Still no image appears. Lastly, if I call stdout.py from the command prompt, then I will see the stream of data that makes up the png image. So at least I am no longer getting the traceback error. Does anyone try to show their graphs without actually saving the png file? Any help would be greatly appreciated. -Rodney - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Png stream through Stdout to the web (Answer)
Ok, I found the answer and just wanted to post it for the archives. My script now begins with: #!c:/Python25/python.exe -u import os,sys import cgi import cgitb; cgitb.enable() # set HOME environment variable to a directory the httpd server can write to os.environ[ 'HOME' ] = 'c:/www/app/tmp/' Then, before the savefig(), I had to set the content type: print "Content-Type: image/png\n" Then all worked well. I'll keep the agg backend script installed until the next release of matplotlib. Thanks John and Michael... So much help, short response times. -Rodney -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rodney Haynie Sent: Monday, May 19, 2008 10:21 PM To: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Png stream through Stdout to the web Sorry, my file name is stdout.py, in both places. And here it is: #!c:/Python25/python.exe -u import sys import matplotlib matplotlib.use('Agg') from pylab import * plot ([1 ,2 ,3]) savefig( sys.stdout ) - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Png stream through Stdout to the web (Answer)
On Mon, May 19, 2008 at 10:26 PM, Rodney Haynie <[EMAIL PROTECTED]> wrote: > Ok, I found the answer and just wanted to post it for the archives. Thanks Rodney -- when posting for the archives, be sure to reply to the original thread and not change the subject (eg adding "answer") since that will break threading in many news readers and hence may destroy the context for future googlers. Thanks for posting the answer -- if you have the time, consider writing a matplotlib cookook recipe for your webapp server at http://www.scipy.org/Cookbook/Matplotlib JDH - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib 0.91.2 build failure
Dear all, I am building the 0.91.2 version on a Fedora 9. I have compiled this version on Fedora 8 earlier with no problem. However, this time the package failed to build. Here is the last lines from the output: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC -I/usr/local/include -I/usr/include -I. -I/usr/include/python2.5 -c ttconv/pprdrv_tt2.cpp -o build/temp.linux-i686-2.5/ttconv/pprdrv_tt2.o In file included from ttconv/pprdrv_tt2.cpp:40: ttconv/truetype.h:50: error: ISO C++ forbids declaration of 'FILE' with no type ttconv/truetype.h:50: error: expected ';' before '*' token error: command 'gcc' failed with exit status 1 The compilers I use are gcc 4.3.0 (with g++). Is there anything broken, or I'm missing something? Thanks in advance. Cong. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users