[Matplotlib-users] nonlinear axes for imshow
Hello, I have the following problem. I want the axes (only the y-axis, to be exact) of a imshow() graph to be nonlinear. By default, the axis goes linearily from 0 to (number of pixels). With the [extent] keyword, I can change that to going linearly from (arbitrary start) to (arbitrary end). Now, I'd like the axis to be dependend on a (bijective) arbitrary function, for example y=p^2 (when p is the pixel number and y the y-axis coordinate). How can I achieve this? Thanks a lot, cheers Thomas -- View this message in context: http://www.nabble.com/nonlinear-axes-for-imshow-tp25853828p25853828.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] zooming and panning with blit
Hi all, I am just started to use matplotlib and have a question about using blit method to animate plots. I wrote something like this to show the initial plot (other part of the code not shown): l1, = p1.plot(lineout, animated=True) p1.set_xlabel(xlabel) p1.axis(data_range) plt.draw() background = canvas.copy_from_bbox(p1.bbox) p1.draw_artist(l1) canvas.blit(p1.bbox) ... This works and showes the first plot, however, zooming and panning using the toolbar will make plot disappear (only empty background left). So I wonder if there is a way to make zooming and panning work with the blit method. Thank you! Chengkun -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Draw twin axes below main axes
Hi, I want to make a plot with ordinary subplots, each of which has a second axes set created with twinx(). Now, the second axes are always drawn over the first, but I want the main data, which is associated with the left Y axis, to be in front. (If I understand the code correctly, the zorder doesn't help here since it only applies to stuff within one axes set.) I've already tried reversing the order of the two axes in figure.axes, but that results in (apparently) only the first axes being drawn. Is there a way to get this working? thanks, Georg -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Little issue with blitting technique
Hello, I've just discovered blitting technique to improve performances. I'm using this example http://matplotlib.sourceforge.net/examples/animation/animation_blit_qt4. html I encounter an issue if instead of using subplot I use add_axes method to hand define where I want my plot. In this case blitting is no more working like if restore_region was not restoring context... def __init__(self): FigureCanvas.__init__(self, Figure()) #self.ax = self.figure.add_subplot(111) self.ax = self.figure.add_axes([0.1,0.1,0.8,0.2]) Any idea why in this case the example given is not working? Cheers, Laurent -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Some icons do not showup after packaging with py2exe or pyinstaller
Hello, Whether method I use to package my python app, I always reach the issue where the toolbar does not display some icons whiel the subplot is well displayed. Each time the packaging method copy mpl-data where the .exe is created so file are or should be at the right location. Does anybody has encountered this issue /solved it? If not, can someone explain me the basic process behind finding the pictures inside matplotlib? So I'l try to debug this with py2exe and pyinstaller team. Ps: using matplotlib 0.99.1 + pyqt 4.4 Thx a lot for any direction! Laurent attachment: packaging_issue.png-- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background colours
On Wednesday 07 October 2009 16:15:03 mariama...@aquaterraenerg wrote: Hi, I am quite new to python and matplotlib!! When plotting a simple graph using python and matplotlib my plot appears however the area (background) where my x.label and y.label and axes limits lie is grey, does anyone know how to set this to another color ie. white Thanks Maria import matplotlib.pyplot as plt plt.figure(facecolor='white') # from the docu: # facecolor : the background color; defaults to rc figure.facecolor Kind regards Matthias -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] MathTextParser, maxdict ... Assertion failed!
Hello, I did an application that uses bitmaps constructed with MathTextParser as described in the example http://matplotlib.sourceforge.net/examples/user_interfaces/mathtext_wx.html (I work with Windows XP, python 2.5, Matplotlib 0.98.5 and wxPython 2.8.10.1) After making a lot of these bitmaps (from about 50 to 150...) the program crash as described in the thread [matplotlib-devel] Fontcache problem on windows http://www.mail-archive.com/matplotlib-de...@lists.sourceforge.net/msg02353.html. I spent hours on this problem ... and I found this : It seems to come from the maxdict(50) instance used by the MathTextParser as cache : if I replace it by a simple dict, my program works fine ... but the cache never stop to grow up ! Has anyone (among developpers ?) an idea for doing things better. Thanks by advance Cédrick PS : Please, be indulgent with my English ... -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MathTextParser, maxdict ... Assertion failed!
Cédrick FAURY wrote: Hello, I did an application that uses bitmaps constructed with MathTextParser as described in the example http://matplotlib.sourceforge.net/examples/user_interfaces/mathtext_wx.html (I work with Windows XP, python 2.5, Matplotlib 0.98.5 and wxPython 2.8.10.1) After making a lot of these bitmaps (from about 50 to 150...) the program crash as described in the thread [matplotlib-devel] Fontcache problem on windows http://www.mail-archive.com/matplotlib-de...@lists.sourceforge.net/msg02353.html. I don't think these problems are related. One is a cache of math expression images, the other is a cache of fonts. I am unable to reproduce this on Matplotlib 0.98.5.3 on Linux (don't have a Windows box handy). Can you run the attached script (which is just a modification of mathtext_wx.py to generate 60 different math expressions, and let me know if that crashes for you? If not, we need to track down the difference between what this script does and what yours does that causes the crash. Can you share a minimal script that reproduces the bug? It would also be useful to see a traceback (you may need to run your script from the commandline in Windows rather than double-clicking, in order to get the full traceback output). Thanks, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA Demonstrates how to convert mathtext to a wx.Bitmap for display in various controls on wxPython. import matplotlib matplotlib.use(WxAgg) from numpy import arange, sin, pi, cos, log from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure import wx IS_GTK = 'wxGTK' in wx.PlatformInfo IS_WIN = 'wxMSW' in wx.PlatformInfo IS_MAC = 'wxMac' in wx.PlatformInfo # This is where the magic happens. from matplotlib.mathtext import MathTextParser mathtext_parser = MathTextParser(Bitmap) def mathtext_to_wxbitmap(s): ftimage, depth = mathtext_parser.parse(s, 150) return wx.BitmapFromBufferRGBA( ftimage.get_width(), ftimage.get_height(), ftimage.as_rgba_str()) functions = [] for i in range(150): functions.append((r'$\frac{x}{%d}$' % i, lambda x: x)) class CanvasFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, size=(550, 350)) self.SetBackgroundColour(wx.NamedColor(WHITE)) self.figure = Figure() self.axes = self.figure.add_subplot(111) self.change_plot(0) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.add_buttonbar() self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.add_toolbar() # comment this out for no toolbar menuBar = wx.MenuBar() # File Menu menu = wx.Menu() menu.Append(wx.ID_EXIT, Exit\tAlt-X, Exit this simple sample) menuBar.Append(menu, File) if IS_GTK or IS_WIN: # Equation Menu menu = wx.Menu() for i, (mt, func) in enumerate(functions): bm = mathtext_to_wxbitmap(mt) item = wx.MenuItem(menu, 1000 + i, ) item.SetBitmap(bm) menu.AppendItem(item) self.Bind(wx.EVT_MENU, self.OnChangePlot, item) menuBar.Append(menu, Functions) self.SetMenuBar(menuBar) self.SetSizer(self.sizer) self.Fit() def add_buttonbar(self): self.button_bar = wx.Panel(self) self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW) for i, (mt, func) in enumerate(functions): bm = mathtext_to_wxbitmap(mt) button = wx.BitmapButton(self.button_bar, 1000 + i, bm) self.button_bar_sizer.Add(button, 1, wx.GROW) self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button) self.button_bar.SetSizer(self.button_bar_sizer) def add_toolbar(self): Copied verbatim from embedding_wx2.py self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() if IS_MAC: self.SetToolBar(self.toolbar) else: tw, th = self.toolbar.GetSizeTuple() fw, fh = self.canvas.GetSizeTuple() self.toolbar.SetSize(wx.Size(fw, th)) self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) self.toolbar.update() def OnPaint(self, event): self.canvas.draw() def OnChangePlot(self, event): self.change_plot(event.GetId() - 1000) def change_plot(self, plot_number): t = arange(1.0,3.0,0.01) s = functions[plot_number][1](t)
[Matplotlib-users] unclutter the axis
hi, is there a way to put a label every two o three ticks, instead of putting it on every tick? the following works but it's a little cumbersome: ax.set_yticklabels([pos % 2 != 0 and '%.2f' % num or '' for pos, num in enumerate(ax.get_yticks())]) cheers, Ernest -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MathTextParser, maxdict ... Assertion failed!
Thank you for responding so quickly !! I don't think these problems are related. One is a cache of math expression images, the other is a cache of fonts. I know ... and i found a lot of way to reproduce the same crash... I am unable to reproduce this on Matplotlib 0.98.5.3 on Linux (don't have a Windows box handy). Can you run the attached script (which is just a modification of mathtext_wx.py to generate 60 different math expressions, and let me know if that crashes for you? This script does'nt work (it causes a PyAssertion error : invalid stock id) But with this more simple attached script : For 50 bitmaps, the crash occurs after the window is closed (with the cross). For 250, the crash occurs before the apparition of the window In the Command prompt : Assertion failed: ob_refcnt == 0, file CXX\cxx_extensions.cxx, line 1128 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. No more traceback ... Cédrick Demonstrates how to convert mathtext to a wx.Bitmap for display in various controls on wxPython. import matplotlib matplotlib.use(WxAgg) from numpy import arange, sin, pi, cos, log from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.backends.backend_wx import NavigationToolbar2Wx from matplotlib.figure import Figure import wx IS_GTK = 'wxGTK' in wx.PlatformInfo IS_WIN = 'wxMSW' in wx.PlatformInfo IS_MAC = 'wxMac' in wx.PlatformInfo # This is where the magic happens. from matplotlib.mathtext import MathTextParser mathtext_parser = MathTextParser(Bitmap) def mathtext_to_wxbitmap(s): ftimage, depth = mathtext_parser.parse(s, 150) return wx.BitmapFromBufferRGBA( ftimage.get_width(), ftimage.get_height(), ftimage.as_rgba_str()) functions = [] for i in range(250): functions.append((r'$\frac{x}{%d}$' % i, lambda x: x)) class CanvasFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, size=(550, 350)) self.SetBackgroundColour(wx.NamedColor(WHITE)) self.scroll = wx.ScrolledWindow(self, -1) self.scroll.SetScrollRate(20,20) self.sizer = wx.BoxSizer(wx.VERTICAL) for f in functions: self.sizer.Add(wx.StaticBitmap(self.scroll, -1, mathtext_to_wxbitmap(f[0]))) self.scroll.FitInside() self.scroll.SetSizer(self.sizer) class MyApp(wx.App): def OnInit(self): frame = CanvasFrame(None, wxPython mathtext demo app) self.SetTopWindow(frame) frame.Show(True) return True app = MyApp() app.MainLoop() -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MathTextParser, maxdict ... Assertion failed!
Cédrick FAURY wrote: Thank you for responding so quickly !! I don't think these problems are related. One is a cache of math expression images, the other is a cache of fonts. I know ... and i found a lot of way to reproduce the same crash... I am unable to reproduce this on Matplotlib 0.98.5.3 on Linux (don't have a Windows box handy). Can you run the attached script (which is just a modification of mathtext_wx.py to generate 60 different math expressions, and let me know if that crashes for you? This script does'nt work (it causes a PyAssertion error : invalid stock id) If it's a PyAssertion error, it should have a traceback. Is there not one? Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] MathTextParser, maxdict ... Assertion failed!
This script does'nt work (it causes a PyAssertion error : invalid stock id) If it's a PyAssertion error, it should have a traceback. Is there not one? No, this problem is not related with Matplotlib : the PyAssertion error occurs when creating the wx.Menu ... Cédrick -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot color as a function of values?
Maybe a little shorter is the where() keyword, and even that can be omitted: ax.plot(t[where(s=0)],s[where(s=0)],g) ax.plot(t[where(s0)],s[where(s0)],r) or, shorter: ax.plot(t[s=0],s[s=0],g) ax.plot(t[s0],s[s0],r) cheers Thomas Xavier Gnata-2 wrote: Hi, Imagine you have something like: from pylab import * t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) ax = subplot(111) ax.plot(t, s) That's fine but now I would like to plot the negative parts of the curve in red and the positive one in green. Is there a nice pylab oriented way to do that? Some kind of conditional formating? Xavier -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://www.nabble.com/plot-color-as-a-function-of-values--tp25848622p25858967.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] ImportError: No module named ma
Hi all, I am on Mac OS 10.5 and numpy 1.3.0 and matplotlib 0.91.1. When I run a qtdemo script, it fails with File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/numerix/ma/__init__.py, line 16, in module from numpy.core.ma import * ImportError: No module named ma Any ideas? I have a mixed up system where I have installed my own version of Python 2.6 and Apple's version at 2.5. Presently I am using Apple's version of Python. Kind regards, Chaitanya Diagnostics follow!! cka...@vaayu:~/Downloads/pyqt_dataplot_demo python-osx qt_mpl_dataplot.pyw Traceback (most recent call last): File qt_mpl_dataplot.pyw, line 18, in module from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/backends/backend_qt4agg.py, line 9, in module from matplotlib.figure import Figure File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/figure.py, line 10, in module from axes import Axes, Subplot, PolarSubplot, PolarAxes File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/axes.py, line 6, in module import matplotlib.numerix.npyma as ma File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/numerix/__init__.py, line 166, in module __import__('ma', g, l) File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/numerix/ma/__init__.py, line 16, in module from numpy.core.ma import * ImportError: No module named ma cka...@vaayu:~ python-osx Python 2.5.1 (r251:54863, Feb 6 2009, 19:02:12) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type help, copyright, credits or license for more information. import numpy print numpy module 'numpy' from '/Library/Python/2.5/site-packages/numpy-1.3.0-py2.5-macosx-10.5-i386.egg/numpy/__init__.pyc' import numpy.core print numpy.core module 'numpy.core' from '/Library/Python/2.5/site-packages/numpy-1.3.0-py2.5-macosx-10.5-i386.egg/numpy/core/__init__.pyc' import numpy.core.ma Traceback (most recent call last): File stdin, line 1, in module ImportError: No module named ma import matplotlib print matplotlib module 'matplotlib' from '/Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/__init__.pyc' -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ImportError: No module named ma
On 2009-10-12 11:58 AM, Chaitanya Krishna wrote: Hi all, I am on Mac OS 10.5 and numpy 1.3.0 and matplotlib 0.91.1. When I run a qtdemo script, it fails with File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/numerix/ma/__init__.py, line 16, inmodule from numpy.core.ma import * ImportError: No module named ma Any ideas? I have a mixed up system where I have installed my own version of Python 2.6 and Apple's version at 2.5. Presently I am using Apple's version of Python. Apple's version of Python comes with numpy 1.0.1, before numpy.core.ma was introduced. It seems like your installation of numpy 1.3.0 did not override Apple's version. To double-check: import numpy print numpy.__file__ -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ImportError: No module named ma
Hi all, numpy.__file__ gives 1.3.0 import numpy print numpy.__file__ /Library/Python/2.5/site-packages/numpy-1.3.0-py2.5-macosx-10.5-i386.egg/numpy/__init__.pyc Chaitanya On Mon, Oct 12, 2009 at 7:11 PM, Robert Kern robert.k...@gmail.com wrote: On 2009-10-12 11:58 AM, Chaitanya Krishna wrote: Hi all, I am on Mac OS 10.5 and numpy 1.3.0 and matplotlib 0.91.1. When I run a qtdemo script, it fails with File /Library/Python/2.5/site-packages/matplotlib-0.91.1-py2.5-macosx-10.5-i386.egg/matplotlib/numerix/ma/__init__.py, line 16, inmodule from numpy.core.ma import * ImportError: No module named ma Any ideas? I have a mixed up system where I have installed my own version of Python 2.6 and Apple's version at 2.5. Presently I am using Apple's version of Python. Apple's version of Python comes with numpy 1.0.1, before numpy.core.ma was introduced. It seems like your installation of numpy 1.3.0 did not override Apple's version. To double-check: import numpy print numpy.__file__ -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
Group, This error occurs for me with Matplotlib 0.99.1, Python 2.5.4 and 2.6.2, while using the Qt4Agg backend on Windows XP. Basically, savefig('aweomse_plot.pdf') barfs if I have some math text in there. For example: -- |C:\Documents and Settings\phobsonipython26 -pylab |Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 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 | | Welcome to pylab, a matplotlib-based Python environment. | For more information, type 'help(pylab)'.In [1]: x = arange(10) | |In [2]: y = 0.5*x**2 | |In [3]: plot(x,y,'ko') |Out[3]: [matplotlib.lines.Line2D object at 0x039F3C10] | |In [4]: savefig('test.png') | |In [5]: savefig('test.pdf') | |In [6]: xlabel('rSome math: $X$') |Out[6]: matplotlib.text.Text object at 0x03A7A350 | |In [7]: savefig('test.pdf') -- Spits out a nasty error at Input Line 7. I've include it below my sig for those who might want to look at it. I don't know much about back ends, but I feel like I've neglected to install something since the last line of the TraceBack includes ValueError: unichr() arg not in range(0x1) (narrow Python build). I have an update-version of MikTeX on this machine. Any thoughts? Many thanks, Paul M. Hobson Senior Staff Engineer -- Geosyntec Consultants 55 SW Yamhill St, Ste 200 Portland, OR 97204 Phone: (503) 222-9518 Web: www.geosyntec.com Erros message: In [7]: savefig('test.pdf') ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (550, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (550, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (550, 0)) --- ValueErrorTraceback (most recent call last) C:\Documents and Settings\phobson\ipython console in module() C:\Python26\lib\site-packages\matplotlib\pyplot.pyc in savefig(*args, **kwargs) 354 def savefig(*args, **kwargs): 355 fig = gcf() -- 356 return fig.savefig(*args, **kwargs) 357 if Figure.savefig.__doc__ is not None: 358 savefig.__doc__ = dedent(Figure.savefig.__doc__) C:\Python26\lib\site-packages\matplotlib\figure.pyc in savefig(self, *args, **kwargs) 1030 patch.set_alpha(0.0) 1031 - 1032 self.canvas.print_figure(*args, **kwargs) 1033 1034 if transparent: C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.pyc in print_figure(self, *args, **kwargs) 141 self.update(l, self.renderer.height-t, w, h) 142 143 def print_figure(self, *args, **kwargs): -- 144 FigureCanvasAgg.print_figure(self, *args, **kwargs) 145 self.draw() C:\Python26\lib\site-packages\matplotlib\backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation format, **kwargs) 1474 orientation=orientation, 1475 bbox_inches_restore=_bbox_inches_restore, - 1476 **kwargs) 1477 finally: 1478 if bbox_inches and restore_bbox: C:\Python26\lib\site-packages\matplotlib\backend_bases.pyc in print_pdf(self, *args, **kwargs) 1332 from backends.backend_pdf import FigureCanvasPdf # lazy import 1333 pdf = self.switch_backends(FigureCanvasPdf) - 1334 return pdf.print_pdf(*args, **kwargs) 1335 1336 def print_png(self, *args, **kwargs): C:\Python26\lib\site-packages\matplotlib\backends\backend_pdf.pyc in print_pdf(self, filename, **kwargs) 2023 width, height, image_dpi, RendererPdf(file, image_dpi), 2024 bbox_inches_restore=_bbox_inches_restore) - 2025 self.figure.draw(renderer) 2026 renderer.finalize() 2027 if isinstance(filename, PdfPages): # finish off this page C:\Python26\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *kl) 44 def draw_wrapper(artist, renderer, *kl): 45 before(artist, renderer) --- 46 draw(artist, renderer, *kl) 47 after(artist, renderer) 48 C:\Python26\lib\site-packages\matplotlib\figure.pyc in draw(self, renderer) 771 772 # render the axes -- 773
Re: [Matplotlib-users] ImportError: No module named ma
On 2009-10-12 12:19 PM, Chaitanya Krishna wrote: Hi all, numpy.__file__ gives 1.3.0 import numpy print numpy.__file__ /Library/Python/2.5/site-packages/numpy-1.3.0-py2.5-macosx-10.5-i386.egg/numpy/__init__.pyc Ah, right. I'm sorry. numpy.core.ma is not the location of that subpackage anymore. It is now numpy.ma. Upgrade to a more recent matplotlib. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
phob...@geosyntec.com writes: |C:\Documents and Settings\phobsonipython26 -pylab Could you try this in plain Python? I'm asking because you seem to be getting an IPython warning about a possibly corrupted traceback: ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (550, 0)) I suggest you write your commands in a script and run it with python script.py --verbose-debug so that we can get a better picture of where it is going wrong. Also, does it matter that you are using Qt4Agg? You can test this by trying python script.py -d pdf --verbose-debug If that works, then the problem could be related to Qt4Agg specifically, but if it fails, it is somewhere else. -- Jouni K. Seppänen http://www.iki.fi/jks -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot color as a function of values?
ax.plot(t[s=0],s[s=0],g) ax.plot(t[s0],s[s0],r) Whaou! That's what I call a nice pythonic syntax. XAvier Maybe a little shorter is the where() keyword, and even that can be omitted: ax.plot(t[where(s=0)],s[where(s=0)],g) ax.plot(t[where(s0)],s[where(s0)],r) or, shorter: ax.plot(t[s=0],s[s=0],g) ax.plot(t[s0],s[s0],r) cheers Thomas Xavier Gnata-2 wrote: Hi, Imagine you have something like: from pylab import * t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) ax = subplot(111) ax.plot(t, s) That's fine but now I would like to plot the negative parts of the curve in red and the positive one in green. Is there a nice pylab oriented way to do that? Some kind of conditional formating? Xavier -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
Sheesh it's been a weird day. I failed to reply to the whole list. Jouni, sorry about the duplciate message... phob...@geosyntec.com writes: |C:\Documents and Settings\phobsonipython26 -pylab From: Jouni K. Seppänen [mailto:j...@iki.fi] Could you try this in plain Python? I'm asking because you seem to be getting an IPython warning about a possibly corrupted traceback: ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (550, 0)) I suggest you write your commands in a script and run it with python script.py --verbose-debug Jouni: Thanks for the prompt reply. I did just that. Calling the script both ways (w/ and w/o the PDF backend) fails with a lot of out. This time I've included the verbose output as an attached text file. I apologize of that's a mailing list faux pas. Here's the code for the script, pyTest.py: import pylab as pl x = pl.arange(6) y = x + 5 pl.plot(x,y,'ko', zorder=10) pl.xlabel('X-label, no TeX') pl.ylabel('Y-label. no math') pl.savefig('no_math.png') pl.savefig('no_math.pdf') pl.xlabel(r'some math: $\tau_{y}$') pl.savefig('some_math.png') pl.savefig('some_math.pdf') # EOF no_math.* and some_math.png are created just fine. The error occurred trying to create some_math.pdf. I'm really at a loss b/c I could swear I created fairly complex figures with output to PDF about a week ago and don't recall changing my Python or MPL installation. so that we can get a better picture of where it is going wrong. Also, does it matter that you are using Qt4Agg? You can test this by trying Both seemed to provide the same error message, so I've only included the verbose output from C:\Python25python c:\GDAG2009\python\pyTest.py -d pdf --verbose-debug For grins and giggles, I went to my matplotlibrc file and commented out the lines telling MPL to use Droid fonts (even though they never gave me a problem before). That didn't change anything. Thanks again, -paul C:\Python25python c:\GDAG2009\python\pyTest.py -d pdf --verbose-debug $HOME=C:\Documents and Settings\phobson CONFIGDIR=C:\Documents and Settings\phobson\.matplotlib matplotlib data path C:\Python25\lib\site-packages\matplotlib\mpl-data loaded rc file C:\Documents and Settings\phobson\.matplotlib\matplotlibrc matplotlib version 0.99.1 verbose.level debug interactive is False units is False platform is win32 loaded modules: ['numpy.lib._iotools', 'xml.sax.urlparse', 'distutils', 'matplotlib.errno', 'pylab', 'subprocess', 'gc', 'matplotl ib.tempfile', 'distutils.sysconfig', 'ctypes._endian', 'encodings.encodings', 'matplotlib.colors', 'msvcrt', 'numpy.testing.sys', 'numpy.core.info', 'xml', 'numpy.fft.types', 'numpy.ma.operator', 'numpy.ma.cPickle', 'struct', 'numpy.random.info', 'tempfile', ' xml.sax.urllib', 'numpy.linalg', 'matplotlib.threading', 'numpy.testing.operator', 'imp', 'numpy.testing', 'collections', 'numpy.c ore.umath', '_struct', 'distutils.types', 'numpy.lib.numpy', 'numpy.core.scalarmath', 'matplotlib.matplotlib', 'string', 'matplotl ib.subprocess', 'numpy.testing.os', 'matplotlib.locale', 'numpy.lib.arraysetops', 'numpy.testing.unittest', 'numpy.lib.math', 'mat plotlib.__future__', 'numpy.testing.re', 'itertools', 'numpy.version', 'numpy.lib.re', 'distutils.re', 'ctypes.os', 'numpy.core.os ', 'numpy.lib.type_check', 'numpy.lib.__builtin__', 'signal', 'numpy.lib.types', 'numpy.lib._datasource', 'random', 'threading', ' token', 'numpy.fft.fftpack_lite', 'matplotlib.cbook', 'ctypes.ctypes', 'xml.sax.xmlreader', 'numpy.__builtin__', 'dis', 'distutils .version', 'cStringIO', 'numpy.ma.core', 'numpy.numpy', 'matplotlib.StringIO', 'locale', 'numpy.add_newdocs', 'numpy.lib.getlimits ', 'xml.sax.saxutils', 'matplotlib.numpy', 'numpy.lib.sys', 'encodings', 'numpy.ma.itertools', 'numpy.lib.io', 'numpy.ma.extras', 'numpy.testing.decorators', 'matplotlib.warnings', 'matplotlib.string', '_subprocess', 'urllib', 'matplotlib.sys', 're', 'numpy.li b._compiled_base', 'ntpath', 'new', 'numpy.random.mtrand', 'math', 'numpy.fft.helper', 'numpy.ma.warnings', 'inspect', 'numpy.ma.i nspect', 'UserDict', 'numpy.lib.function_base', 'distutils.os', 'matplotlib', 'numpy.fft.numpy', 'numpy.lib.ufunclike', 'numpy.lib .info', 'numpy.core.numerictypes', 'ctypes', 'numpy.lib.warnings', 'ctypes.struct', 'codecs', 'numpy.core._sort', 'numpy.os', '_lo cale', 'matplotlib.sre_constants', 'matplotlib.os', 'thread', 'StringIO', 'numpy.core.memmap', 'traceback', 'weakref', 'numpy.core ._internal', 'numpy.fft.fftpack', 'opcode', 'numpy.linalg.lapack_lite', 'distutils.sys', 'os', 'numpy.lib.itertools', '__future__' , 'matplotlib.copy', 'xml.sax.types', 'matplotlib.traceback', '_sre', 'unittest', 'numpy.core.sys', 'numpy.random', 'numpy.linalg. numpy', '__builtin__', 'numpy.lib.twodim_base', 'matplotlib.re', 'numpy.core.cPickle', 'operator', 'numpy.core.arrayprint', 'distu tils.string',
Re: [Matplotlib-users] plot color as a function of values?
Xavier Gnata wrote: ax.plot(t[s=0],s[s=0],g) ax.plot(t[s0],s[s0],r) I don't think it does what you want, though, unless you are plotting markers, not lines. With lines, you will have line segments approximately on the x-axis across the gaps. Using masked arrays avoids that. The gaps (masked segments) will not be stroked. Eric Whaou! That's what I call a nice pythonic syntax. XAvier Maybe a little shorter is the where() keyword, and even that can be omitted: ax.plot(t[where(s=0)],s[where(s=0)],g) ax.plot(t[where(s0)],s[where(s0)],r) or, shorter: ax.plot(t[s=0],s[s=0],g) ax.plot(t[s0],s[s0],r) cheers Thomas Xavier Gnata-2 wrote: Hi, Imagine you have something like: from pylab import * t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) ax = subplot(111) ax.plot(t, s) That's fine but now I would like to plot the negative parts of the curve in red and the positive one in green. Is there a nice pylab oriented way to do that? Some kind of conditional formating? Xavier -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] nonlinear axes for imshow
thkoe002 wrote: Hello, I have the following problem. I want the axes (only the y-axis, to be exact) of a imshow() graph to be nonlinear. By default, the axis goes linearily from 0 to (number of pixels). With the [extent] keyword, I can change that to going linearly from (arbitrary start) to (arbitrary end). Now, I'd like the axis to be dependend on a (bijective) arbitrary function, for example y=p^2 (when p is the pixel number and y the y-axis coordinate). How can I achieve this? Thanks a lot, cheers Thomas See http://matplotlib.sourceforge.net/examples/pylab_examples/image_nonuniform.html Eric -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ImportError: No module named ma
Hi, I solved it by installing matplotlib 0.99. But, on Mac 10.5 when I used easy_install matplotlib, it was still saying that 0.91 was the latest and I couldn't install it. Finally I had to download the egg and manually install it (easy_install --install-dir) Cheers, Chaitanya On Mon, Oct 12, 2009 at 8:23 PM, Robert Kern robert.k...@gmail.com wrote: On 2009-10-12 12:19 PM, Chaitanya Krishna wrote: Hi all, numpy.__file__ gives 1.3.0 import numpy print numpy.__file__ /Library/Python/2.5/site-packages/numpy-1.3.0-py2.5-macosx-10.5-i386.egg/numpy/__init__.pyc Ah, right. I'm sorry. numpy.core.ma is not the location of that subpackage anymore. It is now numpy.ma. Upgrade to a more recent matplotlib. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
phob...@geosyntec.com writes: File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 1378, in draw_mathtext self.file.output(self.encode_string(unichr(num), fonttype), Op.show) ValueError: unichr() arg not in range(0x1) (narrow Python build) Right, IPython really had mangled the traceback. That looks like the mathtext parser is outputting some characters outside the Basic Multilingual Plane. Could you try the following: python -i c:\GDAG2009\python\pyTest.py -d pdf Then when the error occurs, you should be at a Python prompt. Then type (or just copy and paste from here - be careful with the first two lines, since any exception will cause Python to forget the existing traceback): from pdb import pm pm() p fontname, fontsize, num, symbol_name p s, width, height, descent, glyphs, rects, used_characters p fonttype, global_fonttype It might work to set pdf.fonttype to 3 in matplotlibrc, but even if it helps, it would be useful to find the root of this problem. -- Jouni K. Seppänen http://www.iki.fi/jks -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
On 10/12/2009 04:17 PM, Jouni K. Seppänen wrote: phob...@geosyntec.com writes: File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 1378, in draw_mathtext self.file.output(self.encode_string(unichr(num), fonttype), Op.show) ValueError: unichr() arg not in range(0x1) (narrow Python build) Right, IPython really had mangled the traceback. That looks like the mathtext parser is outputting some characters outside the Basic Multilingual Plane. Could you try the following: python -i c:\GDAG2009\python\pyTest.py -d pdf Then when the error occurs, you should be at a Python prompt. Then type (or just copy and paste from here - be careful with the first two lines, since any exception will cause Python to forget the existing traceback): from pdb import pm pm() p fontname, fontsize, num, symbol_name p s, width, height, descent, glyphs, rects, used_characters p fonttype, global_fonttype It might work to set pdf.fonttype to 3 in matplotlibrc, but even if it helps, it would be useful to find the root of this problem. What is your mathtext.fontset setting? If it's stixsans, then it is possible that mathtext would produce codepoints outside of the BMP (this is due to the way the STIX fonts are encoded). Unfortunately, the standard Python builds for Windows don't support characters in this range. There might actually be a work around possible in the PDF backend -- but it will have to involve encoding Unicode characters without using Python unicode objects. I'm looking into a patch now. Cheers, Mike -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ImportError: No module named ma
On Mon, Oct 12, 2009 at 3:21 PM, Robert Kern robert.k...@gmail.com wrote: On 2009-10-12 15:16 PM, Chaitanya Krishna wrote: Hi, I solved it by installing matplotlib 0.99. But, on Mac 10.5 when I used easy_install matplotlib, it was still saying that 0.91 was the latest and I couldn't install it. Finally I had to download the egg and manually install it (easy_install --install-dir) I suspect that that version of easy_install has not been fixed to parse Sourceforge's new download pages. Shouldn't easy_install be reading the pypi data, which points to the proper sf page? http://pypi.python.org/pypi/matplotlib JDH -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
Jouni, I found the error! I got bored this past weekend and changed my mathtext.fontset to 'stixsans' just to see hopw it would look -- and then forgot about it. Changing that value back to 'cm' let's my original code and pyTest.py run without errors. I really appreciate your help with this and all of the other insight I've gained from the regular contributers to this list. Many thanks, -paul Regardless, here's my command line output with stixsans as my mathtext.fontset: C:\Python25python -i c:\gdag2009\python\pyTest.py -d pdf Traceback (most recent call last): File c:\gdag2009\python\pyTest.py, line 12, in module pl.savefig('some_math.pdf') File C:\Python25\Lib\site-packages\matplotlib\pyplot.py, line 356, in savefig return fig.savefig(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 1032, in savefig self.canvas.print_figure(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_qt4agg.py, line 144, in print_figure FigureCanvasAgg.print_figure(self, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backend_bases.py, line 1476, in print_figure **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backend_bases.py, line 1334, in print_pdf return pdf.print_pdf(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 2025, in print_pdf self.figure.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 773, in draw for a in self.axes: a.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File C:\Python25\Lib\site-packages\matplotlib\axes.py, line 1735, in draw a.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File C:\Python25\Lib\site-packages\matplotlib\axis.py, line 757, in draw self.label.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\text.py, line 565, in draw ismath=ismath) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 1516, in draw_text if ismath: return self.draw_mathtext(gc, x, y, s, prop, angle) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 1378, in draw_mathtext self.file.output(self.encode_string(unichr(num), fonttype), Op.show) ValueError: unichr() arg not in range(0x1) (narrow Python build) from pdb import pm pm() c:\python25\lib\site-packages\matplotlib\backends\backend_pdf.py(1378)draw_mathtext() - self.file.output(self.encode_string(unichr(num), fonttype), Op.show) (Pdb) p fontname, fontsize, num, symbol_name ('C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXGeneralItalic.ttf', 7.0, 120378, 'u1D63A') (Pdb) p s, width, height, descent, glyphs, rects, used_characters ('some math: $\\tau_{y}$', 72.0, 11.0, 3.0, [(0.0, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\V era.ttf', 10.0, 115, 's'), (5.2099609375, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 111, 'o'), (11.328125, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 109, 'm'), (21.0693359375, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 101, 'e'), (2 7.2216796875, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 32, 'space'), (30.400 390625, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 109, 'm'), (40.1416015625, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 97, 'a'), (46.26953125, 3.40625, 'C :\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 116, 't'), (50.1904296875, 3.40625, 'C:\\Pytho n25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 104, 'h'), (56.5283203125, 3.40625, 'C:\\Python25\\lib \\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 58, 'colon'), (59.8974609375, 3.40625, 'C:\\Python25\\lib\\sit e-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 32, 'space'), (63.076171875, 3.40625, 'C:\\Python25\\lib\\site-pack ages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXNonUniIta.ttf', 10.0, 57835, 'uniE1EB'), (67.75616455078125, 2.046875, 'C:\\Python25\\ lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXGeneralItalic.ttf', 7.0, 120378, 'u1D63A')], [], {'C:\\Python25\\lib\\si te-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXGeneralItalic.ttf': ('C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\f onts\\ttf\\STIXGeneralItalic.ttf', set([120378])),
Re: [Matplotlib-users] ImportError: No module named ma
BTW, please do not Cc: me. I am subscribed to the list and read through GMane. It's annoying to get list replies to my email where I don't want them. On 2009-10-12 15:38 PM, John Hunter wrote: On Mon, Oct 12, 2009 at 3:21 PM, Robert Kernrobert.k...@gmail.com wrote: On 2009-10-12 15:16 PM, Chaitanya Krishna wrote: Hi, I solved it by installing matplotlib 0.99. But, on Mac 10.5 when I used easy_install matplotlib, it was still saying that 0.91 was the latest and I couldn't install it. Finally I had to download the egg and manually install it (easy_install --install-dir) I suspect that that version of easy_install has not been fixed to parse Sourceforge's new download pages. Shouldn't easy_install be reading the pypi data, which points to the proper sf page? http://pypi.python.org/pypi/matplotlib Yup, but the link URLs are of the form http://sourceforge.net/.../foo.egg/download which does not obviously mean this is the URL for foo.egg unless if you know to remove the final /download part. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
Mike, Thanks for the reply. I found that I had (on a whim) set my mathtext.fontset to stixsans and then forgot about it. Returning that value to cm fixes my issues. In short, I'm all squared away now. Thanks! Paul M. Hobson -Original Message- From: Michael Droettboom [mailto:md...@stsci.edu] Sent: Monday, October 12, 2009 1:38 PM To: matplotlib-users@lists.sourceforge.net Subject: Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg On 10/12/2009 04:17 PM, Jouni K. Seppänen wrote: phob...@geosyntec.com writes: File C:\Python25\Lib\site- packages\matplotlib\backends\backend_pdf.py, line 1378, in draw_mathtext self.file.output(self.encode_string(unichr(num), fonttype), Op.show) ValueError: unichr() arg not in range(0x1) (narrow Python build) Right, IPython really had mangled the traceback. That looks like the mathtext parser is outputting some characters outside the Basic Multilingual Plane. Could you try the following: python -i c:\GDAG2009\python\pyTest.py -d pdf Then when the error occurs, you should be at a Python prompt. Then type (or just copy and paste from here - be careful with the first two lines, since any exception will cause Python to forget the existing traceback): from pdb import pm pm() p fontname, fontsize, num, symbol_name p s, width, height, descent, glyphs, rects, used_characters p fonttype, global_fonttype It might work to set pdf.fonttype to 3 in matplotlibrc, but even if it helps, it would be useful to find the root of this problem. What is your mathtext.fontset setting? If it's stixsans, then it is possible that mathtext would produce codepoints outside of the BMP (this is due to the way the STIX fonts are encoded). Unfortunately, the standard Python builds for Windows don't support characters in this range. There might actually be a work around possible in the PDF backend -- but it will have to involve encoding Unicode characters without using Python unicode objects. I'm looking into a patch now. Cheers, Mike -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errors with PDF (TeX-string) output using Qt4Agg
Thanks. On further investigation, I was reminded that stixsans (or anything not in the BMP) doesn't work with Type 42 fonts. The way the PDF spec forces you to deal with them, if it's even possible, is really hairy. So to solve your problem you can either a) not use stixsans, or b) use Type 3 fonts. We should document this somewhere. In any case, we should still fix the crash bug on narrow (e.g. Windows) Python builds, so the behavior of no characters printed is at least the same on all environments. We should probably add some Type 3 vs. Type 42 font regression tests as well. Mike On 10/12/2009 04:43 PM, phob...@geosyntec.com wrote: Jouni, I found the error! I got bored this past weekend and changed my mathtext.fontset to 'stixsans' just to see hopw it would look -- and then forgot about it. Changing that value back to 'cm' let's my original code and pyTest.py run without errors. I really appreciate your help with this and all of the other insight I've gained from the regular contributers to this list. Many thanks, -paul Regardless, here's my command line output with stixsans as my mathtext.fontset: C:\Python25python -i c:\gdag2009\python\pyTest.py -d pdf Traceback (most recent call last): File c:\gdag2009\python\pyTest.py, line 12, inmodule pl.savefig('some_math.pdf') File C:\Python25\Lib\site-packages\matplotlib\pyplot.py, line 356, in savefig return fig.savefig(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 1032, in savefig self.canvas.print_figure(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_qt4agg.py, line 144, in print_figure FigureCanvasAgg.print_figure(self, *args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backend_bases.py, line 1476, in print_figure **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backend_bases.py, line 1334, in print_pdf return pdf.print_pdf(*args, **kwargs) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 2025, in print_pdf self.figure.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File C:\Python25\Lib\site-packages\matplotlib\figure.py, line 773, in draw for a in self.axes: a.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File C:\Python25\Lib\site-packages\matplotlib\axes.py, line 1735, in draw a.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\artist.py, line 46, in draw_wrapper draw(artist, renderer, *kl) File C:\Python25\Lib\site-packages\matplotlib\axis.py, line 757, in draw self.label.draw(renderer) File C:\Python25\Lib\site-packages\matplotlib\text.py, line 565, in draw ismath=ismath) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 1516, in draw_text if ismath: return self.draw_mathtext(gc, x, y, s, prop, angle) File C:\Python25\Lib\site-packages\matplotlib\backends\backend_pdf.py, line 1378, in draw_mathtext self.file.output(self.encode_string(unichr(num), fonttype), Op.show) ValueError: unichr() arg not in range(0x1) (narrow Python build) from pdb import pm pm() c:\python25\lib\site-packages\matplotlib\backends\backend_pdf.py(1378)draw_mathtext() - self.file.output(self.encode_string(unichr(num), fonttype), Op.show) (Pdb) p fontname, fontsize, num, symbol_name ('C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\STIXGeneralItalic.ttf', 7.0, 120378, 'u1D63A') (Pdb) p s, width, height, descent, glyphs, rects, used_characters ('some math: $\\tau_{y}$', 72.0, 11.0, 3.0, [(0.0, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\V era.ttf', 10.0, 115, 's'), (5.2099609375, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 111, 'o'), (11.328125, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 109, 'm'), (21.0693359375, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 101, 'e'), (2 7.2216796875, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 32, 'space'), (30.400 390625, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 109, 'm'), (40.1416015625, 3.40625, 'C:\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 97, 'a'), (46.26953125, 3.40625, 'C :\\Python25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 116, 't'), (50.1904296875, 3.40625, 'C:\\Pytho n25\\lib\\site-packages\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf', 10.0, 104, 'h'), (56.5283203125,
Re: [Matplotlib-users] making horizontal axes labels in plots
First of all, I recommend you to use spines instead of SubplotZero of axes_grid toolkit. http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html If you use axes_grid toolkit, keep in mind that some axis-related command of matplotlib may not work. Please take a look at the documentation. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline If something does not work, see if ax.axis[xzero].set_visible(True) solves the problem. This will recover the original behavior of matplotlib, but some functionality of axes_grid toolkit may not work anymore. To have a horizontal label with axes_grid, ax.axis[left].get_helper()._label_angles[left]=0 While it is best if something like ax.axis[left].label.set_rotation(horizontal) work, but it does not currently. I'll try to fix this in time but use one of the options above. Regards, -JJ On Sun, Oct 11, 2009 at 8:09 PM, per freem perfr...@gmail.com wrote: hi all, i am trying to make horizontal (as opposed to the default vertical) rotated labels for axes in my subplots. i tried using the 'orientation' optional argument, as follows: from numpy import * from scipy import * from mpl_toolkits.axes_grid.axislines import SubplotZero import matplotlib.pyplot as plt fig = plt.figure() ax = SubplotZero(fig, 3, 1, 1) ax1 = fig.add_subplot(ax) ax.axis[xzero].set_visible(True) plt.plot([1,2,3], label=line a, c='r') plt.plot([1.2, 2.4, 3.01], label=line b, c='b') plt.ylabel(hello, rotation='horizontal') ax = SubplotZero(fig, 3, 1, 2) ax2 = fig.add_subplot(ax) plt.plot([1,2,3], label=line a, c='r') plt.plot([1.2, 2.4, 3.01], label=line b, c='b') plt.ylabel(world) ax = SubplotZero(fig, 3, 1, 3) ax3 = fig.add_subplot(ax) plt.plot([1,2,3], label=line a, c='r') plt.plot([1.2, 2.01, 3.01], label=line b, c='b') plt.figlegend([ax1.lines[0], ax1.lines[1]], [line a, line b], 'upper right') but it does not work. both the labels hello and world of the y axes are displayed in their default vertical orientation. the argument seems to have no effect. i am using matplotlib '0.99.0' on Mac OS X. any ideas how to fix this? thanks. -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Draw twin axes below main axes
On Fri, Oct 9, 2009 at 10:55 AM, Georg Brandl georg.bra...@frm2.tum.de wrote: Hi, I want to make a plot with ordinary subplots, each of which has a second axes set created with twinx(). Now, the second axes are always drawn over the first, but I want the main data, which is associated with the left Y axis, to be in front. (If I understand the code correctly, the zorder doesn't help here since it only applies to stuff within one axes set.) I've already tried reversing the order of the two axes in figure.axes, but that results in (apparently) only the first axes being drawn. Is there a way to get this working? Reordering the axes should work. The reason for only the first axes being shown is that the frame (white background) of the main axes blocks the content of the twin axes. Try something like below. fig.axes = [ax2, ax1] # reorder ax1.set_frame_on(False) ax2.set_frame_on(True) Regards, -JJ thanks, Georg -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users