Re: [Matplotlib-users] Pixel coordinates and plot_date()
Replying to myself... Erik Cederstrand wrote: Hi! I'm trying to make a clickable plot_date() plot (using the Pylons framework). What I need is the pixel coordinates of the data points I give to plot_date(), but the trans.seq_x_y() function doesn't like Datetime: xcoords, ycoords = trans.seq_x_y(x, y) float() argument must be a string or a number How can I get the pixel coordinates? Here are the relevant parts of my code (x is Datetime, y is float): figure = pylab.figure(figsize=(6,4), dpi=100, frameon=False) ax = figure.add_subplot(111) # quick simple scatter plot ax.plot_date(x, y, 'ro') # Convert the data set points into screen space coordinates trans = ax.get_transform() xcoords, ycoords = trans.seq_x_y(x, y) Thanks to the excellent documentation, I solved this by using dates.date2num(): xcoords, ycoords = trans.seq_x_y(dates2num(x), y) Erik - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] FuncFormatter and Colorbar
Hi Thorsten, On Wednesday 09 January 2008 15:35, Thorsten Kranz wrote: Hi list, Hi Matthias, I found another way to deal with this problem. when defining the colorbar, one can give an additional kwarg format, so by defining the kwarg format=formatter, we solved the problem. I'm happy that your problem disappeared, but I still have a question. On my system the problem still exist, if I use format=formatter in colorbar and after that use cb.ax.yaxis.set_major_formatter(formatter) in the example-code of my last email. Can anybody confirm this behaviour (data range 0.0 ... 0.54 - 0.0 ... 0.95)? And if so: Is this the expected behaviour? best regards, Matthias Anyway, I think an option as Matthias implemented would be very handy for all those users like us here in Germany who might want to have the numbers formatted with commata. Greetings, Thorsten 2008/1/9, Matthias Michler [EMAIL PROTECTED]: Hello list, Hello Thorsten, On Wednesday 09 January 2008 11:38, Thorsten Kranz wrote: I have a question concerning reformatting of axis-ticks via the FuncFormatter-class. In german, it's common to use a comma as separator for decimal numbers instead of a dot. To realize it in matplotlib, I do something like from matplotlib.ticker import FuncFormatter import pylab pylab.figure() formatter = FuncFormatter(lambda x,pos: (%.2f%x).replace(.,,)) ax = pylab.axes() ax.xaxis.set_major_formatter(formatter) ax.yaxis.set_major_formatter(formatter) ax.plot(pylab.arange(0,1,0.1),pylab.arange(0,1,0.1)) This works fine for me, I had the same idea ;-). The problem is that you have a fixed number of digits behind the comma, which is not the desirable behaviour during zoom. I changed the ticker.py/ axes.py files to circumwait this disadvantage. I attached a patch showing my changes and maybe somebody can test it. You can activate it using: ax.ticklabel_format(style='comma') for an ScalarFormatter but I encounter a problem when I do an imshow-command with a colorbar. In the imshow-axes, it's o.k., but for the colorbar it doesn't really work. I do cb = pylab.colorbar() cb.ax.yaxis.set_major_formatter(formatter) and, actually, all dots are replaced by com9mata, but the values are also changed! E.g. instead of the old values (without formatter) from 0-0.54, the values are increased to 0-0.95. [...] Can anyone explain why it doesn't work out as I expect it to work? I don't know were the problem comes from. I attached your example in a slitly modified version and this shows that the problem is not due to your special formatting. It occurs with matplotlib.ticker.ScalarFormatter, too. best regards, Matthias Or is there a better, more standard way to substitute the dots by commata? Thanks, Thorsten - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketpl ace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem installing 0.91.2 egg on OS X 10.4
Apparently a dynamic link snuck into the build. Typically everything is statically included. You can see this by running the following command: uaternion:matplotlib cmoad$ otool -L ft2font.so ft2font.so: /usr/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.16.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.6) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) I will created and post a new build asap. Thanks, Charlie On Jan 11, 2008 1:50 PM, Michele Vallisneri [EMAIL PROTECTED] wrote: Hello all, after installing matplotlib 0.91.2 from the sourceforge egg on OS X 10.4.11 (Python 2.5.1), I get the following error: import pylab Traceback (most recent call last): File stdin, line 1, in module File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/pylab.py, line 208, in module from matplotlib import mpl # pulls in most modules File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/mpl.py, line 3, in module from matplotlib import axis File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/axis.py, line 20, in module from font_manager import FontProperties File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/font_manager.py, line 40, in module from matplotlib import ft2font ImportError: dlopen(/Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup It seems there's something wrong with ft2font.so, since CDing to the egg directory and importing only that extension yields import ft2font.so Traceback (most recent call last): File stdin, line 1, in module ImportError: dlopen(./ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup Any ideas? Cheers, Michele - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Problem installing 0.91.2 egg on OS X 10.4
Hello all, after installing matplotlib 0.91.2 from the sourceforge egg on OS X 10.4.11 (Python 2.5.1), I get the following error: import pylab Traceback (most recent call last): File stdin, line 1, in module File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/pylab.py, line 208, in module from matplotlib import mpl # pulls in most modules File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/mpl.py, line 3, in module from matplotlib import axis File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/axis.py, line 20, in module from font_manager import FontProperties File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/font_manager.py, line 40, in module from matplotlib import ft2font ImportError: dlopen(/Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup It seems there's something wrong with ft2font.so, since CDing to the egg directory and importing only that extension yields import ft2font.so Traceback (most recent call last): File stdin, line 1, in module ImportError: dlopen(./ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup Any ideas? Cheers, Michele - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem installing 0.91.2 egg on OS X 10.4
I have replaced the binary with a working version. Thanks again for the catch, Charlie On Jan 11, 2008 2:15 PM, Charlie Moad [EMAIL PROTECTED] wrote: Apparently a dynamic link snuck into the build. Typically everything is statically included. You can see this by running the following command: uaternion:matplotlib cmoad$ otool -L ft2font.so ft2font.so: /usr/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.16.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.6) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) I will created and post a new build asap. Thanks, Charlie On Jan 11, 2008 1:50 PM, Michele Vallisneri [EMAIL PROTECTED] wrote: Hello all, after installing matplotlib 0.91.2 from the sourceforge egg on OS X 10.4.11 (Python 2.5.1), I get the following error: import pylab Traceback (most recent call last): File stdin, line 1, in module File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/pylab.py, line 208, in module from matplotlib import mpl # pulls in most modules File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/mpl.py, line 3, in module from matplotlib import axis File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/axis.py, line 20, in module from font_manager import FontProperties File /Users/vallis/lib/python2.5/site-packages/matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/font_manager.py, line 40, in module from matplotlib import ft2font ImportError: dlopen(/Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup It seems there's something wrong with ft2font.so, since CDing to the egg directory and importing only that extension yields import ft2font.so Traceback (most recent call last): File stdin, line 1, in module ImportError: dlopen(./ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup Any ideas? Cheers, Michele - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem installing 0.91.2 egg on OS X 10.4
It works! Thanks for such quick turnaround! If I may add a suggestion for the matplotlib setup from sources (which I had tried just after the egg install failed): The directory specified to the --prefix argument of setup.py would seem like a natural addition to basedir in setupext.py (of course it's always possible, but more awkward to edit it). The scenario (which matches mine) is a user of a computing cluster who has no administrator access, and is installing all libraries in $HOME/lib and $HOME/include. The prefix can be extracted from the line arguments with installation_prefix = None for arg in sys.argv: if arg.startswith('--prefix='): installation_prefix = arg.split('=', 1)[1] if installation_prefix: basedir.append(installation_prefix) I'm sure there is another method to do this that fits more naturally with distutils. There's a reference to --prefix later in setupext.py, but I don't think it's operational. Thanks again, Michele On Jan 11, 2008, at 12:58 PM, Charlie Moad wrote: I have replaced the binary with a working version. Thanks again for the catch, Charlie On Jan 11, 2008 2:15 PM, Charlie Moad [EMAIL PROTECTED] wrote: Apparently a dynamic link snuck into the build. Typically everything is statically included. You can see this by running the following command: uaternion:matplotlib cmoad$ otool -L ft2font.so ft2font.so: /usr/local/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.16.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.6) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) I will created and post a new build asap. Thanks, Charlie On Jan 11, 2008 1:50 PM, Michele Vallisneri [EMAIL PROTECTED] wrote: Hello all, after installing matplotlib 0.91.2 from the sourceforge egg on OS X 10.4.11 (Python 2.5.1), I get the following error: import pylab Traceback (most recent call last): File stdin, line 1, in module File /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/pylab.py, line 208, in module from matplotlib import mpl # pulls in most modules File /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/mpl.py, line 3, in module from matplotlib import axis File /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/axis.py, line 20, in module from font_manager import FontProperties File /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2- py2.5-macosx-10.3-fat.egg/matplotlib/font_manager.py, line 40, in module from matplotlib import ft2font ImportError: dlopen(/Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup It seems there's something wrong with ft2font.so, since CDing to the egg directory and importing only that extension yields import ft2font.so Traceback (most recent call last): File stdin, line 1, in module ImportError: dlopen(./ft2font.so, 2): Symbol not found: _FT_Attach_File Referenced from: /Users/vallis/lib/python2.5/site-packages/ matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg/matplotlib/ft2font.so Expected in: dynamic lookup Any ideas? Cheers, Michele - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/ marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users