Re: [Matplotlib-users] How to have few marks on the lines?
Hi Jae, Thanks for your reply and letting me know about this. Can you please point me to some code example? Cheers, Omer On Thu, May 20, 2010 at 20:38, Jae-Joon Lee lee.j.j...@gmail.com wrote: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot use *markevery* keyword. http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D.set_markevery If you want more control, you can always draws the lines (without markers) first and overplot markers in positions you want separately. Regards, -JJ On Wed, May 19, 2010 at 11:56 AM, Omer Khalid omer.kha...@cern.ch wrote: Hi, I am a wondering if it's possible to have few line distinguishing marks on the data lines on a chart such as circle, start, square. When I use some thing like this for the color of the graph (i.e. rs, k^), it uses the shape for each data point and the lines becomes very thick. All I want is to put 4-5 shaper markers on each line with line (the data line will have few hundred data points). Many thanks, Omer -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Clearing A Figure (I Know That This Has Been Posted Before But I Does Not Work For Me)
I am attempting to run a lot of tests automatically and generate a graph for each one. However, at the moment, the previous graph remains on the figure and the next plot is drawn over it. I have read extensively the documentation and I have tried a whole lot of different commands but to no avail. In the previous post it said to use pylab.clf() which is exactly what I've been trying to use. So far I have used pylab.cla(), pylab.clf() and pylab.close() although I believe that this only closes an open figure window. I have no idea why it is not working now especially since it would appear that my question had already been answered in both the documentation and the forums. I am using Python 2.6.4 on Ubuntu Linux. Here is the relevant code I am using: pylab.plot(xAxis, TrainingPoints, 'b-') pylab.plot(xAxis, TestPoints, 'r-') pylab.xlabel('Epochs') pylab.ylabel('Sum Squared Error') pylab.title('Plot of Iris Training Errors') outfilename = str(int(LEARNING_RATE)) + .png print outfilename pylab.ylim(ymin=0) pylab.savefig(outfilename) pylab.cla() pylab.clf() I really hope one of you can spot an error otherwise I am completely stuck. -- View this message in context: http://old.nabble.com/Clearing-A-Figure-%28I-Know-That-This-Has-Been-Posted-Before-But-I-Does-Not-Work-For-Me%29-tp28665976p28665976.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to have few marks on the lines?
On Tue, May 25, 2010 at 6:46 AM, Omer Khalid omer.kha...@cern.ch wrote: Hi Jae, Thanks for your reply and letting me know about this. Can you please point me to some code example? In [226]: t = np.arange(0, 2, 0.05) In [227]: s = np.sin(2*np.pi*t) In [228]: plot(t, s, '-') Out[228]: [matplotlib.lines.Line2D object at 0x9ef1fcc] Approach 1: In [229]: plot(t, s, 'o', markevery=10) Out[229]: [matplotlib.lines.Line2D object at 0x9eb932c] Approach 2: In [230]: plot(t[::5], s[::5], 's') Out[230]: [matplotlib.lines.Line2D object at 0x1431f30c] -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Clearing A Figure (I Know That This Has Been Posted Before But I Does Not Work For Me)
On Tue, May 25, 2010 at 4:08 AM, Thistleryver mhar...@ec.auckland.ac.nz wrote: I am attempting to run a lot of tests automatically and generate a graph for each one. However, at the moment, the previous graph remains on the figure and the next plot is drawn over it. I have read extensively the documentation and I have tried a whole lot of different commands but to no avail. In the previous post it said to use pylab.clf() which is exactly what I've been trying to use. So far I have used pylab.cla(), pylab.clf() and pylab.close() although I believe that this only closes an open figure window. I have no idea why it is not working now especially since it would appear that my question had already been answered in both the documentation and the forums. I am using Python 2.6.4 on Ubuntu Linux. Here is the relevant code I am using: pylab.plot(xAxis, TrainingPoints, 'b-') pylab.plot(xAxis, TestPoints, 'r-') pylab.xlabel('Epochs') pylab.ylabel('Sum Squared Error') pylab.title('Plot of Iris Training Errors') outfilename = str(int(LEARNING_RATE)) + .png print outfilename pylab.ylim(ymin=0) pylab.savefig(outfilename) pylab.cla() pylab.clf() w/o seeing the entire code it is difficult to diagnose. Nothing looks wrong with your code. However, for full control I suggest you use the API; see examples at http://matplotlib.sourceforge.net/examples/api/index.html and take a look at the artist tutorial at http://matplotlib.sourceforge.net/users/artists.html. In a nutshell fig = plt.figure() ax = fig.add_subplot(111) for param in myparams: fig.clf() ax.plot(something_with(param)) ax.set_ylabel('Sum Squared Error') ax.set_title('Plot of Iris Training Errors') ax.set_ylim(ymin=0) outfilename = '%d.png'%param fig.savefig(outfilename) -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] [matplotlib-devel] basemap domain changes on pyplot call
Chris, If you have lat-long, you can call your basemap object to convert it to map coordinates. I forget if you have to call inverse=True or not. Off the top of my head it would be something like this (assuming 'map' is your Basemap object that has already been initialized): x, y = map(45.0, -104.5, inverse=True) You can find much more accurate information and examples from doing a help(map). Ben Root On Mon, May 24, 2010 at 6:12 PM, Christopher Barker chris.bar...@noaa.govwrote: Jeff Whitaker wrote: On 5/24/10 10:24 AM, Christopher Barker wrote: I need to be able to draw a filled polygon from coordinates in memory, for instance, but didn't see a way to do this directly. Chris: If you have the map projection coordinates of the polygon, nope -- we've got lat-long you can just use the pyplot commands or axes methods, and then use the Basemap set_axes_limits method to make sure the aspect ratio and axes limits get reset correctly. I'll look into that too -- if I have time. Thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
Hi Everyone, I am attempting to compile matplotlib against a 64 bit version of Python 2.6 compiled and installed from source on OSX 10.6 (Snow Leopard). Numpy, scipy, freetype2 and libpng have been installed and work just fine, however I cannot get matplotlib to compile correctly. I get the following output: matplotlib-0.99.1.1 $ sudo python setup.py install BUILDING MATPLOTLIB matplotlib: 0.99.1.1 python: 2.6.5 (r265:79063, May 25 2010, 11:45:36) [GCC 4.2.1 (Apple Inc. build 5659)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.4.1 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: Tkinter: 73770, Tk: 8.5, Tcl: 8.5 wxPython: no * wxPython not found Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to import gtk in your build/install environment Mac OS X native: yes Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: matplotlib will provide adding pytz OPTIONAL USETEX DEPENDENCIES dvipng: 1.12 ghostscript: 8.70 latex: 3.1415926 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil/zoneinfo'] running install running build running build_py copying lib/matplotlib/mpl-data/matplotlibrc - build/lib.macosx-10.6-intel-2.6/matplotlib/mpl-data copying lib/matplotlib/mpl-data/matplotlib.conf - build/lib.macosx-10.6-intel-2.6/matplotlib/mpl-data running build_ext building 'matplotlib.ft2font' extension gcc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPY_ARRAYAUNIQUE_SYMBOL=MPL_ARRAY_API -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I. -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/ft2font.cpp -o build/temp.macosx-10.6-intel-2.6/src/ft2font.o cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++ In file included from src/ft2font.cpp:1: src/ft2font.h:13:22: error: ft2build.h: No such file or directory src/ft2font.h:14:10: error: #include expects FILENAME or FILENAME src/ft2font.h:15:10: error: #include expects FILENAME or FILENAME src/ft2font.h:16:10: error: #include expects FILENAME or FILENAME src/ft2font.h:17:10: error: #include expects FILENAME or FILENAME src/ft2font.h:18:10: error: #include expects FILENAME or FILENAME In file included from src/ft2font.cpp:1: src/ft2font.h:31: error: ‘FT_Bitmap’ has not been declared src/ft2font.h:31: error: ‘FT_Int’ has not been declared src/ft2font.h:31: error: ‘FT_Int’ has not been declared src/ft2font.h:77: error: expected ‘,’ or ‘...’ before ‘’ token src/ft2font.h:77: error: ISO C++ forbids declaration of ‘FT_Face’ with no type src/ft2font.h:83: error: expected ‘,’ or ‘...’ before ‘’ token src/ft2font.h:83: error: ISO C++ forbids declaration of ‘FT_Face’ with no type src/ft2font.h:122: error: ‘FT_Face’ does not name a type src/ft2font.h:123: error: ‘FT_Matrix’ does not name a type src/ft2font.h:124: error: ‘FT_Vector’ does not name a type src/ft2font.h:125: error: ‘FT_Error’ does not name a type src/ft2font.h:126: error: ‘FT_Glyph’ was not declared in this scope src/ft2font.h:126: error: template argument 1 is invalid src/ft2font.h:126: error: template argument 2 is invalid src/ft2font.h:127: error: ‘FT_Vector’ was not declared in this scope src/ft2font.h:127: error: template argument 1 is invalid src/ft2font.h:127: error: template argument 2 is invalid src/ft2font.h:133: error: ‘FT_BBox’ does not name a type src/ft2font.cpp:45: error: ‘FT_Library’ does not name a type src/ft2font.cpp:96: error: variable or
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
Hi, Installing pkg-config sorted things out for me. http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz --George. On 25 May 2010 16:03, Pim Schellart p.schell...@gmail.com wrote: Hi Everyone, I am attempting to compile matplotlib against a 64 bit version of Python 2.6 compiled and installed from source on OSX 10.6 (Snow Leopard). Numpy, scipy, freetype2 and libpng have been installed and work just fine, however I cannot get matplotlib to compile correctly. I get the following output: matplotlib-0.99.1.1 $ sudo python setup.py install BUILDING MATPLOTLIB matplotlib: 0.99.1.1 python: 2.6.5 (r265:79063, May 25 2010, 11:45:36) [GCC 4.2.1 (Apple Inc. build 5659)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.4.1 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: Tkinter: 73770, Tk: 8.5, Tcl: 8.5 wxPython: no * wxPython not found Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to import gtk in your build/install environment Mac OS X native: yes Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: matplotlib will provide adding pytz OPTIONAL USETEX DEPENDENCIES dvipng: 1.12 ghostscript: 8.70 latex: 3.1415926 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil/zoneinfo'] running install running build running build_py copying lib/matplotlib/mpl-data/matplotlibrc - build/lib.macosx-10.6-intel-2.6/matplotlib/mpl-data copying lib/matplotlib/mpl-data/matplotlib.conf - build/lib.macosx-10.6-intel-2.6/matplotlib/mpl-data running build_ext building 'matplotlib.ft2font' extension gcc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPY_ARRAYAUNIQUE_SYMBOL=MPL_ARRAY_API -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I. -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/ft2font.cpp -o build/temp.macosx-10.6-intel-2.6/src/ft2font.o cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++ In file included from src/ft2font.cpp:1: src/ft2font.h:13:22: error: ft2build.h: No such file or directory src/ft2font.h:14:10: error: #include expects FILENAME or FILENAME src/ft2font.h:15:10: error: #include expects FILENAME or FILENAME src/ft2font.h:16:10: error: #include expects FILENAME or FILENAME src/ft2font.h:17:10: error: #include expects FILENAME or FILENAME src/ft2font.h:18:10: error: #include expects FILENAME or FILENAME In file included from src/ft2font.cpp:1: src/ft2font.h:31: error: ‘FT_Bitmap’ has not been declared src/ft2font.h:31: error: ‘FT_Int’ has not been declared src/ft2font.h:31: error: ‘FT_Int’ has not been declared src/ft2font.h:77: error: expected ‘,’ or ‘...’ before ‘’ token src/ft2font.h:77: error: ISO C++ forbids declaration of ‘FT_Face’ with no type src/ft2font.h:83: error: expected ‘,’ or ‘...’ before ‘’ token src/ft2font.h:83: error: ISO C++ forbids declaration of ‘FT_Face’ with no type src/ft2font.h:122: error: ‘FT_Face’ does not name a type src/ft2font.h:123: error: ‘FT_Matrix’ does not name a type src/ft2font.h:124: error: ‘FT_Vector’ does not name a type src/ft2font.h:125: error: ‘FT_Error’ does not name a type src/ft2font.h:126: error: ‘FT_Glyph’ was not declared in this scope src/ft2font.h:126: error: template argument 1 is invalid src/ft2font.h:126: error: template argument 2 is invalid src/ft2font.h:127: error: ‘FT_Vector’ was not declared in this scope
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
On Tue, May 25, 2010 at 10:10 AM, George Nurser gnur...@gmail.com wrote: Hi, Installing pkg-config sorted things out for me. http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz Also, you may want to try the make.osx script which lives beside setup.py. See the associated README.osx file. JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
On Tue, May 25, 2010 at 10:45 AM, Pim Schellart p.schell...@gmail.com wrote: Hi John and George, I tried both and although it now seems to find the libraries it still fails to link something. matplotlib-0.99.1.1 $ sudo python setup.py install According to the README I pointed you too, this isn't the command you should be running. Rather, Example usage:: PREFIX=/Users/jdhunter/dev make -f make.osx fetch deps mpl_install But I advise you work from the svn trunk if you want to go this route, as I have made some updates for 64bit/python2.6 OSX there svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
If what John suggests doesn't work, and you really only need 64 bit, then the nuclear option is to remove all occurrences of -arch i386 from the makefile (assuming you have a framework build) at /Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/config/Makefile This should only generate x86_64. Obviously, save the current one, so you can go back to it. HTH, George. On 25 May 2010 16:58, John Hunter jdh2...@gmail.com wrote: On Tue, May 25, 2010 at 10:45 AM, Pim Schellart p.schell...@gmail.com wrote: Hi John and George, I tried both and although it now seems to find the libraries it still fails to link something. matplotlib-0.99.1.1 $ sudo python setup.py install According to the README I pointed you too, this isn't the command you should be running. Rather, Example usage:: PREFIX=/Users/jdhunter/dev make -f make.osx fetch deps mpl_install But I advise you work from the svn trunk if you want to go this route, as I have made some updates for 64bit/python2.6 OSX there svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac backend problems for nearly all backends.
$%$^#!!! My sincere apologies, gmail sent before I was ready. To continue: GtkCairo: looks great, crashes ipython on resize. Wx: color issues, not stable. Qt: installs from fink, but won't load. In any case, it's not the Gtk/Qt/Wx problems that are important, it's the OSX backend issue. Others whom I work with do not have this issue, but installed using EPD. Has anyone else experienced such problems? Thanks for your help; let me know if there's more info I can provide. -dw On Tue, May 25, 2010 at 12:47 PM, Daniel Welling dantwell...@gmail.comwrote: Greetings. I did quite a bit of digging on this and cannot find similar problems, but if I did miss an earlier discussion, then I apologize. In any case, I have been having royal problems with GUI backends and matplotlib. Some background on where I've been having these problems: Machine 1: OSX 10.5.8 G5 PPC Machine 2: OSX 10.5.7 Macbook pro/Intel Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through fink.) MPL versions: 99.0.1 and 99.1.1 (Older obtained through fink, newer installed from source.) Here are the issues; behavior is consistent on both machines: MacOSX backend: Loads plots quickly, but when I try to save, I cannot type in the file name area of the save file dialog. Furthermore, with ipython, I can continue to use the ipython prompt up until the I shut the plot window. ipython then freezes until I control-c it. This occurs in both versions. TkAgg backend: In 99.0.1, this works fine. However, it is slow, hence my want for a different working backend. in 99.1.1, the plot window opens but the picture is never drawn. After a moment, segfault back to the x11 prompt. Blerg. GtkAgg: Bad color (e.g. the background is pink rather than gray, color tables are way goofed up. Writes to file fine.) -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Mac backend problems for nearly all backends.
Greetings. I did quite a bit of digging on this and cannot find similar problems, but if I did miss an earlier discussion, then I apologize. In any case, I have been having royal problems with GUI backends and matplotlib. Some background on where I've been having these problems: Machine 1: OSX 10.5.8 G5 PPC Machine 2: OSX 10.5.7 Macbook pro/Intel Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through fink.) MPL versions: 99.0.1 and 99.1.1 (Older obtained through fink, newer installed from source.) Compilers: gcc/g++ 4.0.1/Mac. Here are the issues; behavior is consistent on both machines: MacOSX backend: Loads plots quickly, but when I try to save, I cannot type in the file name area of the save file dialog. Furthermore, with ipython, I can continue to use the ipython prompt up until the I shut the plot window. ipython then freezes until I control-c it. This occurs in both versions. TkAgg backend: In 99.0.1, this works fine. However, it is slow, hence my want for a different working backend. in 99.1.1, the plot window opens but the picture is never drawn. After a moment, segfault back to the x11 prompt. Blerg. I've tried nearly all of the GUI tool kits, but ran into some problem: GtkAgg: Bad color (e.g. the background is pink rather than gray, color tables are way goofed up. Writes to file fine.) GtkCairo: looks great, crashes ipython on resize. Wx: color issues, not stable. Qt: installs from fink, but won't load. Fltk: Couldn't get it to install via fink; can't remember why. In any case, it's not the Gtk/Qt/Wx problems that are important, it's the OSX backend issue. Others whom I work with do not have this issue, but installed using the EPD. Has anyone else experienced such problems? Anyone know possible fixes? Given that this occurs on two different machines with two different MPL versions (a total of 4 combinations), I'm guessing it's my fault somehow. Thanks for your help; let me know if there's more info I can provide. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib font in cairo
I've found a little work-a-round to get my custom font. Here it is: from ctypes import windll gdi32 = windll.gdi32 FR_PRIVATE = 0x10 gdi32.AddFontResourceExA(FILENAME_OF_TTF,FR_PRIVATE,0) greetz Frank Am 18.05.2010 16:09, schrieb Michael Droettboom: We went through this a few years ago on the Cairo mailing list. The short answer is you need to copy the fonts from mpl-data to C:\Windows\Fonts to correctly use Cairo. The long answer: Cairo uses fontconfig for font lookup, which by default searches the system font directory (C:\Windows\Fonts). There is an fontconfig API to add another font directory to search, but it is not exposed to Python. The cairo guys don't want to expose it in pycairo because that API is not technically part of cairo, but there isn't a proper Python wrapper to fontconfig, so until one is created we're sort of left with our hands tied. This is probably worthy of a FAQ in the docs. Mike copyrig...@gmx.de wrote: Hallo, I'm try to use MathTextParser output for cairo in my wxpython gui. Works well under ubunutu linux (maybe dublicated font) but fails under windows (screenshot: http://www.ubuntu-pics.de/bild/62985/auswahl_017_RC86gk.png ). How to tell cairo to use the font file from mpl-data? Here some code: from matplotlib.mathtext import MathTextParser from matplotlib.font_manager import ttfFontProperty import wx import wx.lib.wxcairo import cairo #... MPC = MathTextParser(Cairo) dc = wx.BufferedPaintDC(self) ctx = wx.lib.wxcairo.ContextFromDC(dc) #... width, height, descent, glyphs, rects = self.mathtext_parser.parse(r$a_0+a_1\xi+a_2\xi^2+a_3\xi^3$,dpi,prop) #... for font, fontsize, s, ox, oy in glyphs: #... fontProp = ttfFontProperty(font) #... ctx.select_font_face (fontProp.name, self.fontangles [fontProp.style], self.fontweights[fontProp.weight]) #... ctx.show_text(s.encode(utf-8)) #... #... greetz Frank -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac backend problems for nearly all backends.
I've experienced many of the same problems on Mac OS X 10.6.3 (Snow Leopard). I have python/scipy/numpy/matplotlib/ipython all installed via Macports. I found the MacOSX backend to work OK, but I could not save a figure through the GUI. I finally have the WXagg backend working, but that required installed WXPython with the gtk/X11 backend. HTH, Jonathan On 5/25/10 13:19 , matplotlib-users-requ...@lists.sourceforge.net wrote: Date: Tue, 25 May 2010 12:58:49 -0600 From: Daniel Wellingdantwell...@gmail.com Subject: [Matplotlib-users] Mac backend problems for nearly all backends. To:matplotlib-users@lists.sourceforge.net Message-ID: aanlktikidymkiv6ltckwgbhnehrd5ywqpsin9ouny...@mail.gmail.com Content-Type: text/plain; charset=iso-8859-1 Greetings. I did quite a bit of digging on this and cannot find similar problems, but if I did miss an earlier discussion, then I apologize. In any case, I have been having royal problems with GUI backends and matplotlib. Some background on where I've been having these problems: Machine 1: OSX 10.5.8 G5 PPC Machine 2: OSX 10.5.7 Macbook pro/Intel Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through fink.) MPL versions: 99.0.1 and 99.1.1 (Older obtained through fink, newer installed from source.) Compilers: gcc/g++ 4.0.1/Mac. Here are the issues; behavior is consistent on both machines: MacOSX backend: Loads plots quickly, but when I try to save, I cannot type in the file name area of the save file dialog. Furthermore, with ipython, I can continue to use the ipython prompt up until the I shut the plot window. ipython then freezes until I control-c it. This occurs in both versions. TkAgg backend: In 99.0.1, this works fine. However, it is slow, hence my want for a different working backend. in 99.1.1, the plot window opens but the picture is never drawn. After a moment, segfault back to the x11 prompt. Blerg. I've tried nearly all of the GUI tool kits, but ran into some problem: GtkAgg: Bad color (e.g. the background is pink rather than gray, color tables are way goofed up. Writes to file fine.) GtkCairo: looks great, crashes ipython on resize. Wx: color issues, not stable. Qt: installs from fink, but won't load. Fltk: Couldn't get it to install via fink; can't remember why. In any case, it's not the Gtk/Qt/Wx problems that are important, it's the OSX backend issue. Others whom I work with do not have this issue, but installed using the EPD. Has anyone else experienced such problems? Anyone know possible fixes? Given that this occurs on two different machines with two different MPL versions (a total of 4 combinations), I'm guessing it's my fault somehow. Thanks for your help; let me know if there's more info I can provide. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Type 1 font in figures needed
Hi, I'm writing a conference paper and I must use only type 1 fonts. It seems like matplotlib is using type 3. How can I use type 1 instead? Thanks, David The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Type 1 font in figures needed
There isn't a way to embed Type 1 fonts, but you can force matplotlib to use the core 14 Postscript fonts only by setting the rcParam ps.useafm to True. Mike On 05/25/2010 04:10 PM, David Reichert wrote: Hi, I'm writing a conference paper and I must use only type 1 fonts. It seems like matplotlib is using type 3. How can I use type 1 instead? Thanks, David The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Type 1 font in figures needed
On 05/25/2010 10:21 AM, Michael Droettboom wrote: There isn't a way to embed Type 1 fonts, but you can force matplotlib to use the core 14 Postscript fonts only by setting the rcParam ps.useafm to True. Or for the pdf backend, rcParams['pdf.use14corefonts'] = True and refrain from using any mathtext formatting. Eric Mike On 05/25/2010 04:10 PM, David Reichert wrote: Hi, I'm writing a conference paper and I must use only type 1 fonts. It seems like matplotlib is using type 3. How can I use type 1 instead? Thanks, David The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Link from matplotlib webpage hijacked
Hi Gang, I don't know if it is a problem from nabble, but the 'archives' link from the main matplotlib pages goes to a decidedly non-matplotlib page. The link is http://www.nabble.com/matplotlib---users-f2906.html Best -Kaushik -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac backend problems for nearly all backends.
Jonathan Stickel wrote: I've experienced many of the same problems on Mac OS X 10.6.3 (Snow Leopard). I have python/scipy/numpy/matplotlib/ipython all installed via Macports. Just to be clear -- this sounds like a MacPorts problem, not necessarily an OS-X problem. I finally have the WXagg backend working, but that required installed WXPython with the gtk/X11 backend. Does MacPorts not allow a native wx? Maybe becasue you're running 64 bit? Anyway, I guess that's why I don't use macports for python. In any case, I have been having royal problems with GUI backends and matplotlib. Some background on where I've been having these problems: Machine 1: OSX 10.5.8 G5 PPC That's what I've been running, and I've had no real issues (Haven't tried the OS-X back-end) -- but I'm using the python.org python. Machine 2: OSX 10.5.7 Macbook pro/Intel Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through fink.) OK -- then a fink issue, rather than a Macports one -- same idea, though. My impression is that neither fink nor macports do well with Mac GUI stuff -- unless you're talking X11. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac backend problems for nearly all backends.
Are you using a framework install of Python? Also, does the MacOSX backend work with plain python instead of ipython? --Michiel. --- On Tue, 5/25/10, Daniel Welling dantwell...@gmail.com wrote: MacOSX backend: Loads plots quickly, but when I try to save, I cannot type in the file name area of the save file dialog. Furthermore, with ipython, I can continue to use the ipython prompt up until the I shut the plot window. ipython then freezes until I control-c it. This occurs in both versions. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] interpolate inside a circle
Dears, I want to interpolate some irregular data using radial basis. Can I interpolate only the data that falls inside a circle (or a polygon)? TIA -- Prof. Carlos Henrique Grohmann - Geologist D.Sc. Institute of Geosciences - Univ. of São Paulo, Brazil http://www.igc.usp.br/pessoais/guano Linux User #89721 Can’t stop the signal. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac backend problems for nearly all backends.
On 05/25/2010 matplotlib-users-requ...@lists.sourceforge.net wrote: From: Christopher Barker chris.bar...@noaa.gov Subject: Re: [Matplotlib-users] Mac backend problems for nearly all backends. To: matplotlib-users@lists.sourceforge.net Message-ID: 4bfc626c.40...@noaa.gov Content-Type: text/plain; charset=ISO-8859-1; format=flowed Jonathan Stickel wrote: I've experienced many of the same problems on Mac OS X 10.6.3 (Snow Leopard). I have python/scipy/numpy/matplotlib/ipython all installed via Macports. Just to be clear -- this sounds like a MacPorts problem, not necessarily an OS-X problem. I finally have the WXagg backend working, but that required installed WXPython with the gtk/X11 backend. Does MacPorts not allow a native wx? Maybe becasue you're running 64 bit? Right, I am running Snow Leopard and have Python 2.6 installed 64 bit. Apparently, Carbon requires 32 bit and wxWidgets/wxPython does not (yet) support Cocoa. This problem will bite you in one form or another on Mac OS X, regardless of whether you are using Macports or something else. Anyway, I guess that's why I don't use macports for python. See above. In any case, I have been having royal problems with GUI backends and matplotlib. Some background on where I've been having these problems: Machine 1: OSX 10.5.8 G5 PPC That's what I've been running, and I've had no real issues (Haven't tried the OS-X back-end) -- but I'm using the python.org python. Machine 2: OSX 10.5.7 Macbook pro/Intel Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through fink.) OK -- then a fink issue, rather than a Macports one -- same idea, though. My impression is that neither fink nor macports do well with Mac GUI stuff -- unless you're talking X11. Not exactly true. Fink and Macports are tools and have their shortcomings, but both can be immensely useful for installing all this stuff. Otherwise, you do it manually, which of course can cause you trouble as well. Anyway, getting off topic. I only intended to report some form of success with the wx backend. Jonathan -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac backend problems for nearly all backends.
Thanks for the info... 1)The problem does manifest in the same manner through the normal python prompt. 2) I'm not sure what is meant by a framework install. Everything (except MPL 99.1.1) was installed through fink. 3) I've never had problems with Fink software before, and I have a crapload (technical term) of stuff installed. This is neither here nor there, however, as it seems that not all Pythons are created equal. 4) A colleague of mine claims to have everything working on a new Intel mac (I'm guessing 10.5.8) right out of MacPorts; I'll talk to him more and try to find out what is different between our two cases. 5) I have yet to try installing wxPython for python 2.5; this may work in the end. It's not in fink, so I've put off installing it manually. I'll give it a shot and let you know how it works. 6) Although I use x11 and not the native Mac terminal, I'm not sure if this requires me to install different packages for the gui stuff. Could you guys expand on this, please? Finally, I've had some measure of success by installing Qt4 (through Fink) and using the Qt4Agg backend. Because the current stable fink Qt4 release (4.6.1) has a bug, I need to apply the fix found here: http://old.nabble.com/Qt4-backend:-critical-bug-with-PyQt4-v4.6%2B-td26205716.html in order to allow more than one plot per session to be shown. I'll re-write the fix here for convenience and clarity (the original did not have the proper module references in it, so this saves some 5 minutes of tab-completion work in ipython...) # Add this before FigureManagerQT class class FigureWindow(QtGui.QMainWindow): def __init__(self): super(FigureWindow, self).__init__() def closeEvent(self, event): super(FigureWindow, self).closeEvent(event) if QtCore.PYQT_VERSION_STR.startswith('4.6'): self.emit(QtCore.SIGNAL('destroyed()')) # Replace QtGui.QMainWindow by FigureWindow in FigureManagerQT's constructor This works perfectly on my Intel machine running MPL 99.1.1. It's fast and looks sharp. I'll report back on the PPC/99.0 combo tomorrow; Qt4 takes a thousand hours to compile. Thanks for the input. On Tue, May 25, 2010 at 8:48 PM, Jonathan Stickel jjstic...@vcn.com wrote: On 05/25/2010 matplotlib-users-requ...@lists.sourceforge.net wrote: From: Christopher Barker chris.bar...@noaa.gov Subject: Re: [Matplotlib-users] Mac backend problems for nearly all backends. To: matplotlib-users@lists.sourceforge.net Message-ID: 4bfc626c.40...@noaa.gov Content-Type: text/plain; charset=ISO-8859-1; format=flowed Jonathan Stickel wrote: I've experienced many of the same problems on Mac OS X 10.6.3 (Snow Leopard). I have python/scipy/numpy/matplotlib/ipython all installed via Macports. Just to be clear -- this sounds like a MacPorts problem, not necessarily an OS-X problem. I finally have the WXagg backend working, but that required installed WXPython with the gtk/X11 backend. Does MacPorts not allow a native wx? Maybe becasue you're running 64 bit? Right, I am running Snow Leopard and have Python 2.6 installed 64 bit. Apparently, Carbon requires 32 bit and wxWidgets/wxPython does not (yet) support Cocoa. This problem will bite you in one form or another on Mac OS X, regardless of whether you are using Macports or something else. Anyway, I guess that's why I don't use macports for python. See above. In any case, I have been having royal problems with GUI backends and matplotlib. Some background on where I've been having these problems: Machine 1: OSX 10.5.8 G5 PPC That's what I've been running, and I've had no real issues (Haven't tried the OS-X back-end) -- but I'm using the python.org python. Machine 2: OSX 10.5.7 Macbook pro/Intel Code versions: python 2.5.4, Numpy 1.3.0, Scipy 0.7.0 (all obtained through fink.) OK -- then a fink issue, rather than a Macports one -- same idea, though. My impression is that neither fink nor macports do well with Mac GUI stuff -- unless you're talking X11. Not exactly true. Fink and Macports are tools and have their shortcomings, but both can be immensely useful for installing all this stuff. Otherwise, you do it manually, which of course can cause you trouble as well. Anyway, getting off topic. I only intended to report some form of success with the wx backend. Jonathan -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Mac backend problems for nearly all backends.
1)The problem does manifest in the same manner through the normal python prompt. OK that is good to know. 2) I'm not sure what is meant by a framework install. Everything (except MPL 99.1.1) was installed through fink. This is important. Check where python is installed. If 'which python' shows /Library/Frameworks/Python.framework/Versions/2.6/bin/python or something similar, you have a framework version. If on the other hand it shows /usr/bin/python, /usr/local/bin/python, or something similar, you don't have a framework version. I don't know what fink installs by default. If you don't have Python installed as a framework, some backends (including the MacOSX backend) will not interact properly with the window manager. This is a Mac peculiarity. If you build Python from source, you can specify to install a framework version by passing the --enable-framework option to the configure script. 6) Although I use x11 and not the native Mac terminal, I'm not sure if this requires me to install different packages for the gui stuff. Could you guys expand on this, please? Some backends go make use of X11 (e.g., the gtkcairo backend), others do not (e.g., the MacOSX backend). The MacOSX backend should work with both the native Mac terminal and with an X11 terminal. --Michiel. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users