Re: [Matplotlib-users] problems installing matplotlib on OS X Lion
I don't know about changing backends, but I do need to use TkAgg. I finally got it working. The instructions from the original email below are what worked, but first I had to uninstall Tcl8.6 (manually). The first time I tried it I deleted something that I shouldn't have, and ended up with a mess that I cleaned up by doing a full erase/reinstall of Lion. Then I restored the system from a backup, carefully removed Tcl8.6 manually (the uninstall script is broken), removed most of the remnants of macports, reinstalled a few things that were broken by the reinstall of Lion (XCode, XQuartz, WingIDE, TextWrangler), uninstalled and reinstalled Python 2.7.2, reinstalled Tcl8.5, and rebuilt matplotlib per the instructions. Hopefully it will go much smoother when I set up the new system in a few days. Thanks for your help... Lynn On Sep 4, 2011, at 12:55 AM, Michiel de Hoon wrote: What happens if you use the MacOSX backend instead of TkAgg? Or do you have to use TkAgg? --Michiel. --- On Sun, 9/4/11, Lynn Oliver rayco...@gmail.com wrote: From: Lynn Oliver rayco...@gmail.com Subject: Re: [Matplotlib-users] problems installing matplotlib on OS X Lion To: Bryan K Woods bwo...@aer.com Cc: matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Date: Sunday, September 4, 2011, 3:38 AM Bryan, thanks for the response. I installed macports and the environment settings seem to be correct, but when I try port help selfupdate I get: /opt/local/bin/port: line 4: /usr/bin/tclsh: No such file or directory /opt/local/bin/port: line 4: exec: /usr/bin/tclsh: cannot execute: No such file or directory I removed the installation of Tcl 8.6 and reinstalled ActiveTcl 8.5.10, but still get the same warnings. Matplotlib is now complaining about the missing Tcl8.6: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/_tkagg.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.6/Tcl. I am assuming that your unsuccessful install via macports was after you had macports working; do you know what version of Tcl was installed? Macports fails with the same warnings after putting a link to tclsh8.5 in /usr/bin/tchsh. I still seem to be running in circles. Lynn On Sep 3, 2011, at 10:46 PM, Bryan K Woods wrote: I had a problem getting with Lion as well. I was able to work around it by: 1) unsuccessfully trying to install matplotlib for python 2.7 via macports 2) then using easy_install to install matplotlib Bryan K. Woods, Ph.D. Staff Scientist Atmospheric Environmental Research, Inc. bwo...@aer.com On Sep 4, 2011, at 1:06 AM, Lynn Oliver rayco...@gmail.com wrote: After many unsuccessful attempts at getting matplotlib installed on OS X Lion, I ran across this page: Installing Matplotlib on OS X 10.7 with Homebrew « Random Musings for the Digital Age Following these instructions got me the closest I have been: $ brew install python $ brew install gfortran $ brew install pkg-config $ easy_install pip $ pip install numpy $ cd $HOME $ git clone https://github.com/matplotlib/matplotlib.git $ cd matplotlib $ python setup.py build $ python setup.py install At the moment, I'm trying to get a script that was working on EPD 7.1 to work on Python 2.7.2. I'm using the TkAgg backend. The first messages I see when running the script are: objc[68962]: Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. objc[68962]: Class TKMenu is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. objc[68962]: Class TKContentView is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. objc[68962]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. For both Tk and Tcl, ../Versions/Current points to 8.6. From there, everything is fine until it executes show(), when I get the following messages: Exception in Tkinter callback Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py, line 1410, in __call__ return self.func(*args) File /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py, line 236, in resize self.show() File
[Matplotlib-users] Change JPG compression ratio in savefig
Hi, I am using matplotlib.savefig to save my figures as JPEG files. Now I need to reduce the JPG compression ratio. How can I do this? Any hint is appreciated. Frank -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Change JPG compression ratio in savefig
You can use dpi=600 as a parameter to increase the resolution but I'm not sure if that's what you mean. If you mean the actual compression strategy used like to Jpeg2000 per se. Might have to do that after saving the file with an image library (for example, PIL). Cheers, Jeff On 09/06/2011 03:21 AM, Frank Breitling wrote: Hi, I am using matplotlib.savefig to save my figures as JPEG files. Now I need to reduce the JPG compression ratio. How can I do this? Any hint is appreciated. Frank -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error probably due to misconfiguration
Hello, Em 01/09/2011, às 00:16, Eric Firing escreveu: On 08/31/2011 01:15 PM, José Alexandre Nalon wrote: Hello, some weeks ago, I recompiled matplotlib to get locale support for commas, ... This is coming from CXX. I am not going to be able to figure out what the problem is, but those who are (the C++ wizards) will probably want to see the full stack trace, as well as the matplotlib version and the compilation parameters: platform, compiler, python version, etc. The first part of the output from setup.py build has all that. Sorry for taking so long to answer. I was installing Linux on a new laptop, and, as I thought would happen, I could install the newest matplotlib, and it is running without any errors now. As I suspected, it was something in my configuration, I don't know, however, what it could be. I apologize for raising an alarm, though. At first, I was under the impression that that bug could affect more than one person. Glad to see everything working fine. --- José Alexandre Nalon na...@terra.com.br -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] adding scrollbars to plot embedded in tk
Hi Matt, a possible workaround seems to be to embed the figure's canvas in a second Tk canvas using canvas.create_window(...). The second (embedding) canvas handles the appropriate resizing scrolling. I have attached a script below to demonstrate. Unfortunately, scrolling is rather sluggish, but it seems to work - the plot is not resized, and you can scroll around to different areas. Does that help? Cheers Hans On Wed, 31 Aug 2011 22:19:26 +0200, Benjamin Root ben.r...@ou.edu wrote: On Wed, Aug 31, 2011 at 2:55 PM, Matthew Hemke mghe...@gmail.com wrote: I have a plot canvas added to a tk interface (python 2.7.2, matplotlib 1.0.1) according to the recipe here: http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk.html When the window containing the plot is resized the plot shrinks, often leading to REALLY ugly, unreadable plots. I tried adding scrollbars to the canvas returned by get_tk_widget() and they connect as expected (using the yview method). Then, I set a scrollarea config option for the canvas. Everything seems to be working just like a tkinter canvas, but then when the window is resized, the plot still resizes and the scrollbars never activate. I was hoping the plot wouldn't resize and the scrollbars would activate to allow the user to scroll to see the appropriate part of the plot, while still keeping the plot looking pretty. Is there a way (besides editing backend_tkagg.py self.resize method) that would allow the scrollbars to work properly? If my question isn't clear, I can mock up some code, but it may be a bit lengthy, so if anyone can steer me in a better direction that would be great. Thanks, -Matt --- start of script --- from Tkinter import Tk, Frame, Canvas, Scrollbar from Tkconstants import NSEW, HORIZONTAL, EW, NS, ALL from matplotlib import pyplot as plt from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg def doLargePlot(): from numpy.random import randn matrix = randn(100, 100) plt.pcolor(matrix) def getScrollingCanvas(frame): Adds a new canvas with scroll bars to the argument frame NB: uses grid layout @return: the newly created canvas frame.grid(sticky=NSEW) frame.rowconfigure(0, weight=1) frame.columnconfigure(0, weight=1) canvas = Canvas(frame) canvas.grid(row=0, column=0, sticky=NSEW) xScrollbar = Scrollbar(frame, orient=HORIZONTAL) yScrollbar = Scrollbar(frame) xScrollbar.grid(row=1, column=0, sticky=EW) yScrollbar.grid(row=0, column=1, sticky=NS) canvas.config(xscrollcommand=xScrollbar.set) xScrollbar.config(command=canvas.xview) canvas.config(yscrollcommand=yScrollbar.set) yScrollbar.config(command=canvas.yview) return canvas if __name__ == __main__: root = Tk() root.rowconfigure(0, weight=1) root.columnconfigure(0, weight=1) frame = Frame(root) scrollC = getScrollingCanvas(frame) # use more dpi for bigger plot #figure = plt.figure(dpi=200) figure = plt.figure() mplCanvas = FigureCanvasTkAgg(figure, scrollC) canvas = mplCanvas.get_tk_widget() canvas.grid(sticky=NSEW) scrollC.create_window(0, 0, window=canvas) scrollC.config(scrollregion=scrollC.bbox(ALL)) doLargePlot() root.mainloop() --- end of script --- -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Error probably due to misconfiguration
On 09/05/2011 08:29 AM, José Alexandre Nalon wrote: Hello, Em 01/09/2011, às 00:16, Eric Firing escreveu: On 08/31/2011 01:15 PM, José Alexandre Nalon wrote: Hello, some weeks ago, I recompiled matplotlib to get locale support for commas, ... This is coming from CXX. I am not going to be able to figure out what the problem is, but those who are (the C++ wizards) will probably want to see the full stack trace, as well as the matplotlib version and the compilation parameters: platform, compiler, python version, etc. The first part of the output from setup.py build has all that. Sorry for taking so long to answer. I was installing Linux on a new laptop, and, as I thought would happen, I could install the newest matplotlib, and it is running without any errors now. As I suspected, it was something in my configuration, I don't know, however, what it could be. I apologize for raising an alarm, though. At first, I was under the impression that that bug could affect more than one person. Glad to see everything working fine. Thanks for the update, and I'm glad you got it working. Eric --- José Alexandre Nalon na...@terra.com.br mailto:na...@terra.com.br -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contour's clabels overlap each other in an ImageGrid
Hi, I think this is partly because the current clabel implementation of matpltolib does not correctly account the dpi setting. I opened a pull request I think fix this problem. Please try that fix if you can. https://github.com/matplotlib/matplotlib/pull/453 Otherwise, I think you can workaround this by using the default dpi (72 or similar). Regards, -JJ On Fri, Sep 2, 2011 at 11:28 PM, R. O'Gara ronog...@yahoo.com wrote: Jae-Joon, thanks for your reply. There is a combination of effects that make my contour labels placed in unfortunate positions. Here is a self-contained example (somewhat different from issue I originally explained, but illustrates the fact clabels are not where I'd like them to be) import numpy as np import matplotlib as mpl ff = 10 params = { 'text.usetex': True, 'axes.labelsize': ff, 'axes.fontsize': ff, 'legend.fontsize' : ff, 'xtick.labelsize' : ff, 'ytick.labelsize' : ff, 'figure.dpi': 150, 'figure.figsize' : [5,2], } mpl.rcParams.update(params) import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec gs = gridspec.GridSpec(1,2) ax = plt.subplot(gs[0]) xi = np.linspace(0,0.4,100) yi = np.linspace(0,0.4,100) xx,yy = np.meshgrid(xi,yi) zi = np.sin(5*xx*yy) v = np.arange(0.0, 0.5, 0.1) cplot = ax.contour(xi, yi, zi, v, linewidths=0.5, colors='k') ax.clabel(cplot, v, fontsize = 8, inline=True, fmt = %0.2f, ) ax.axis([np.min(xi),np.max(xi),np.min(yi),np.max(yi)]) plt.show() The end result is that contour labels are placed almost outside of the grid, with most of the area in the center being blank. I am pretty sure it has to do with the way rcParams are set, but I have no idea why. Params I do need to set are text.usetex, figure.dpi, and figure.figsize. I am using matplotlib 1.0.1. Thanks for your help, - Original Message - From: Jae-Joon Lee lee.j.j...@gmail.com To: R. O'Gara ronog...@yahoo.com Cc: matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Sent: Monday, August 22, 2011 11:56 PM Subject: Re: [Matplotlib-users] contour's clabels overlap each other in an ImageGrid Can you post an simple self-contained script that reproduces your problem? I just tried something similar but could not reproduces your problem. Here is what I did, Also, what version of matplotlb are you using? Regards, -JJ import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure(1) arr = np.arange(100).reshape((10, 10)) grid = ImageGrid(fig, 111, (2, 2)) cntr0 = grid[0].contour(arr) cntr1 = grid[1].contour(arr) cntr2 = grid[2].contour(arr) cntr3 = grid[3].contour(arr) plt.clabel(cntr0, manual=True) plt.clabel(cntr1, manual=True) plt.clabel(cntr2, manual=True) plt.clabel(cntr3, manual=True) On Thu, Aug 18, 2011 at 1:10 PM, R. O'Gara ronog...@yahoo.com wrote: Hey guys, I was hoping someone could provide a hint for how I should go about correcting this. As you can see, locations for the inline labels for contours in this image are unfortunately chosen, and they overlap with one another. If I set manual to 'True' then I get this weird behavior where I can only choose labels in the top left grid and nothing is shownin any of the other grids. I am using a 2x2 Image Grid (I get the same problem when using gridspec instead of image grid), and loadingcontour data (2x2 array) from a file. Thanks for your help, Ron -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Can't install from PyPi
Hi, Upon trying to install Matplotlib from PyPi, I get the following error message: --- Traceback (most recent call last): File string, line 14, in module File /Users/dpo/.virtualenvs/tsp/build/matplotlib/setup.py, line 162, in module if check_for_tk() or (options['build_tkagg'] is True): File setupext.py, line 832, in check_for_tk (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) IndexError: list index out of range Complete output from command python setup.py egg_info: basedirlist is: [] --- This concerns Matplotlib 1.0.1 on OSX 10.6.8 with Python 2.7 (home built as a framework via Homebrew) in a virtual environment (if that matters). Changing line 832 of setupext.py from (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) to (Tkinter.__version__, Tkinter.TkVersion, Tkinter.TclVersion)) works, but this is the output I get during the build: Tkinter: Tkinter: $Revision$ Dominique -- View this message in context: http://old.nabble.com/Can%27t-install-from-PyPi-tp32404788p32404788.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can't install from PyPi
On 09/05/2011 03:01 PM, dpo wrote: Hi, Upon trying to install Matplotlib from PyPi, I get the following error message: --- Traceback (most recent call last): File string, line 14, inmodule File /Users/dpo/.virtualenvs/tsp/build/matplotlib/setup.py, line 162, inmodule if check_for_tk() or (options['build_tkagg'] is True): File setupext.py, line 832, in check_for_tk (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) IndexError: list index out of range Complete output from command python setup.py egg_info: basedirlist is: [] --- This is fixed in the git repo. I think it is a problem that arises only with some builds of Python 2.7. Eric This concerns Matplotlib 1.0.1 on OSX 10.6.8 with Python 2.7 (home built as a framework via Homebrew) in a virtual environment (if that matters). Changing line 832 of setupext.py from (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) to (Tkinter.__version__, Tkinter.TkVersion, Tkinter.TclVersion)) works, but this is the output I get during the build: Tkinter: Tkinter: $Revision$ Dominique -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can't install from PyPi
efiring wrote: On 09/05/2011 03:01 PM, dpo wrote: Hi, Upon trying to install Matplotlib from PyPi, I get the following error message: --- Traceback (most recent call last): File string, line 14, inmodule File /Users/dpo/.virtualenvs/tsp/build/matplotlib/setup.py, line 162, inmodule if check_for_tk() or (options['build_tkagg'] is True): File setupext.py, line 832, in check_for_tk (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion)) IndexError: list index out of range Complete output from command python setup.py egg_info: basedirlist is: [] --- This is fixed in the git repo. I think it is a problem that arises only with some builds of Python 2.7. You may want to upload the fix to PyPi. That's where most people look for matplotlib I would guess. -- View this message in context: http://old.nabble.com/Can%27t-install-from-PyPi-tp32404788p32405040.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users