[Matplotlib-users] Sequential calls to functions to draw graphs results in flawed graphs on second call.
Running 0.98.5.3 (would upgrade to 1.0 but having trouble installing it on Mac OS X as it doesn't appear to like the version of Python Apple provides). I have a module where there are two functions which call matplotlib to each create a different graph which both saved to an output PNG file. The import statements: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np are at the top of the module file. Neither function imports anything specifically, relying on the above imports. I call each function sequentially. The result is that the first graph is created correctly. The second graph is flawed, and in fact shows the legend from the first function. When I reverse the function calls, which ever graphing function is called first is ok, but second is flawed. If I call each function on it's own, within the same Python session, the graphs (both) get produced flawlessly. both charts are bar charts; but one does a stacked bar and the other is a simple bar chart. Why would I not be able to call the two functions sequentially? Why does the first call interfere with the second call? --rms -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Confusion Matrix
On Sun, Aug 8, 2010 at 8:03 PM, Friedrich Romstedt wrote: > Yes, I agree fully, but have been busy the past few days :-) > > Friedrich > > P.S.: You can also try > http://matplotlib.sourceforge.net/examples/pylab_examples/alignment_test.html > , I believe there was some other manual around also covering the > baseline option, but I cannot find it now. > The "codex" option on the search page helps with this; you can easily search for "codex baseline":: * the default search page: http://matplotlib.sourceforge.net/search.html * what is codex?: http://matplotlib.sourceforge.net/faq/howto_faq.html#search-examples * an example using "codex baseline": http://matplotlib.sourceforge.net/search.html?q=codex+baseline Basically, you go to the default mpl homepage or any sub-page, and from there, click the "Search" link, and then enter "codex YOURPHRASE" where codex stands for "code example" and will return all code examples containing your phrase. JDH -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Building matplotlib from source with libpng (png.h) installed via fink on Mac OS X
Hi, On my Macbook Pro I use Python 2.6 as provided by the Enthought Python Distribution. I ran into some problem with Axes3D so I decided to upgrade to the latest version from source. While trying that I got a similiar error message as discussed in http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg12938.html i.e. error: png.h: No such file or directory In short matplotlib could not find libpng (or png.h from that). I had libpng installed via fink in the usual place /sw/include etc. This seems to be a quite natural choice, so I wondered why matplotlib does not find that out of the box. Following the tips in the above post I looked at basedir in setupext.py For some reason the basedirs for darwin where commented out. Uncommenting the basedirs did the trick for me [1] and matplotlib happily installed with the libpng from fink. Hope this will help other mac users. Thanks for the great work on matplotlib! Cheers, Markus [1] Here the relevant lines for setupext.py 'darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/ local', '/usr', '/sw'], # it appears builds with darwin are broken because of all the # different flags the deps can be compile with, so I am pushing # people to : # make -f make.osx fetch deps mpl_build mpl_install #'_darwin' : [], -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] hbars with different labels left and right
On Sun, Aug 8, 2010 at 10:38 PM, Simon Friedberger wrote: > a) I tried using the twinx() command like in that example but the axes > seem to be scaled differently i.e. the ticks on the right don't have the > same spacing as on the left. > twinx() creates an axes whose y-axis is independent from the original axes. > b) Is it necessary to do that with twinx() or is there a way to set the > labels for both sides independently? > Within a same axes, you cannot change the ticklabels of one side without affecting the other side. This is also true between two axes with shared axis. One option would be to sync the limits of two axis manually (or automatically using event). Another option you may consider is to use the axes_grid1 toolkit (assuming that you're using mpl v1.0). from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost fig = plt.figure() ax = SubplotHost(fig, 111) fig.add_subplot(ax) ax2 = ax.twin() # "twin", not "twinx" ax2.axis["top"].toggle(ticklabels=False) # make ticklabels at top invisible ax2.set_yticks([0.,0.5, 1.]) ax2.set_yticklabels(["A", "B", "C"]) -JJ -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?
It and scipy work very well. I have 64-bit Win 7, HP Pavilon desktop. A re-examination shows the install files are all exe files, except I think for Python. I'm using 2.5 and need to stay there along with numpy 1.2.0. When you say uninstall, you must mean delete the file under C:\Python. Well, it's really not me that needs the help, it's my partner. He went off to 1.4, and it has caused trouble. Let's not go there. :-) On 8/8/2010 4:33 PM, Stephen George wrote: >On 9/08/2010 9:19 AM, Wayne Watson wrote: > >> See Subject. I use matplotlib, scipy, numpy and possibly one other >> module. If I go to the control panel, I only see numpy listed. Why? I >> use a search and find only numpy and Python itself. How can matplotlib >> and scipy be uninstalled? >> >> > In my Win7 (64bit) I have 32 bit python 2.6 installed. > > matplotlib and numpy show under the add remove program functionality > > "Python 2.6 matplotlib-0.99.3" > "Python 2.6 numpy-1.4.1" > > Along with heaps of other libraries I have installed > > Are you sure matplotlib is installed AND working? > > To remove I can only suggest you install again and then remove > > Steve > > -- > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Confusion Matrix
2010/8/8 Simon Friedberger : > I have found a solution. I'm not sure if it's good or intended but the > following works: > > for label in xax.get_ticklabels(): > label.set_rotation(45) > label.set_horizontalalignment('left') This is fully intended. Maybe you can compare with the version attached, I believe my version should have some minor improvement (the labels are anchored all with the baseline's leftmost point at the center of the grid cell). I have not tried your version, though. You got rid of the +0.4 with your solution I believe? Also, for the previous pocoo version still online there, I had a problem with the "superduperverylonglabel". It was shiftet to the left. What is understandable from the point of view that matplotlib anchored the labels' center point at x + 0.4. > Please comment. Apart from that it's here for people who look for a > solution to the same question. Yes, I agree fully, but have been busy the past few days :-) Friedrich P.S.: You can also try http://matplotlib.sourceforge.net/examples/pylab_examples/alignment_test.html , I believe there was some other manual around also covering the baseline option, but I cannot find it now. simon.py Description: Binary data -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?
On 9/08/2010 9:19 AM, Wayne Watson wrote: > See Subject. I use matplotlib, scipy, numpy and possibly one other > module. If I go to the control panel, I only see numpy listed. Why? I > use a search and find only numpy and Python itself. How can matplotlib > and scipy be uninstalled? > In my Win7 (64bit) I have 32 bit python 2.6 installed. matplotlib and numpy show under the add remove program functionality "Python 2.6 matplotlib-0.99.3" "Python 2.6 numpy-1.4.1" Along with heaps of other libraries I have installed Are you sure matplotlib is installed AND working? To remove I can only suggest you install again and then remove Steve -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?
See Subject. I use matplotlib, scipy, numpy and possibly one other module. If I go to the control panel, I only see numpy listed. Why? I use a search and find only numpy and Python itself. How can matplotlib and scipy be uninstalled? -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet "An experiment is a question which science poses to Nature, and a measurement is the recording of Nature’s answer." -- Max Planck Web Page: -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Confused/frustrated w/ waitforbuttonpress
Eric Firing writes: > Try "ipython -pylab". We don't want the threaded version. > > Eric Well, it seems matplotlib svn is required. I got it working after I upgraded from 1.0 to svn (revision 8624 to be precise) and with Ipython 0.11.alpha1. Thanks for the tip again, I am a happier man now ;) Jorge -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Unable to make sequential calls to functions with create matplotlib graphs ... second gets jumbled
On 08/08/2010 12:53 AM, Rob Schneider wrote: > Running 0.98.5.3 > (would upgrade to 1.0 but having trouble installing it on Mac OS X as it > doesn't appear to like the version of Python Apple provides). > Standard procedure on the Mac is to install the python from python.org. That way you don't risk fouling up the python that OS X is depending on, and at the same time your own code can use the version of python that most extension packages are built for. > I have a module where there are two functions which call matplotlib to each > create a different graph which both saved to an output PNG file. The import > statements: > > import matplotlib > matplotlib.use('Agg') > import matplotlib.pyplot as plt > import numpy as np > > are at the top of the module file. Neither function imports anything > specifically, relying on the above imports. > > I call each function sequentially. The result is that the first graph is > created correctly. The second graph is flawed, and in fact shows the legend > from the first function. When I reverse the function calls, which ever > graphing function is called first is ok, but second is flawed. If I call each > function on it's own, within the same Python session, the graphs (both) get > produced flawlessly. > > both charts are bar charts; but one does a stacked bar and the other is a > simple bar chart. > > Why would I not be able to call the two functions sequentially? Why does the > first call interfere with the second call? > I don't think anyone is going to be able to answer this question until you provide a minimal stand-alone code example. Also, the process of stripping your code down to the shortest example that displays the undesired behavior may show you where the problem lies. Eric -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] hbars with different labels left and right
Hi list members! I'm not sure if this is bad style or anything but I'm trying to do something like in this example: http://matplotlib.sourceforge.net/examples/pylab_examples/barchart_demo2.html I would like to haver different labels on both sides. a) I tried using the twinx() command like in that example but the axes seem to be scaled differently i.e. the ticks on the right don't have the same spacing as on the left. Sample code is here: http://paste.pocoo.org/show/247636/ b) Is it necessary to do that with twinx() or is there a way to set the labels for both sides independently? Best Simon -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Unable to make sequential calls to functions with create matplotlib graphs ... second gets jumbled
Running 0.98.5.3 (would upgrade to 1.0 but having trouble installing it on Mac OS X as it doesn't appear to like the version of Python Apple provides). I have a module where there are two functions which call matplotlib to each create a different graph which both saved to an output PNG file. The import statements: import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np are at the top of the module file. Neither function imports anything specifically, relying on the above imports. I call each function sequentially. The result is that the first graph is created correctly. The second graph is flawed, and in fact shows the legend from the first function. When I reverse the function calls, which ever graphing function is called first is ok, but second is flawed. If I call each function on it's own, within the same Python session, the graphs (both) get produced flawlessly. both charts are bar charts; but one does a stacked bar and the other is a simple bar chart. Why would I not be able to call the two functions sequentially? Why does the first call interfere with the second call? --rms -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Confusion Matrix
On 16:00 Fri 06.08.10, Simon Friedberger wrote: > It is about the positioning of the rotated labels. > The code is here: > http://paste.pocoo.org/show/246870/ > > Note that in line 36 I had already remarked about the hack I used. Now I > noticed that if the labels have different lengths rotating them gives > different positions. What I really want to do is rotate about the bottom > of the labels. Can that be done? I have found a solution. I'm not sure if it's good or intended but the following works: for label in xax.get_ticklabels(): label.set_rotation(45) label.set_horizontalalignment('left') Please comment. Apart from that it's here for people who look for a solution to the same question. Best Simon -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users