Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 24 Oct 2011, Rich Shepard wrote: so no more tracebacks? I'll try again tomorrow morning before I head to the dentist. I didn't try then, but just did now. Still the same error: Found an unknown keyword in AFM header (was Underline) Traceback (most recent call last): File ./eikos.py, line 6, in module from modelPage import modModel File /home/rshepard/development/trunk/modelPage.py, line 9, in module from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas File /usr/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py, line 20, in module from matplotlib.figure import Figure File /usr/lib/python2.6/site-packages/matplotlib/figure.py, line 18, in module from axes import Axes, SubplotBase, subplot_class_factory File /usr/lib/python2.6/site-packages/matplotlib/axes.py, line 14, in module import matplotlib.axis as maxis File /usr/lib/python2.6/site-packages/matplotlib/axis.py, line 10, in module import matplotlib.font_manager as font_manager File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 1323, in module _rebuild() File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 1273, in _rebuild fontManager = FontManager() File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 997, in __init__ self.afmlist = createFontList(self.afmfiles, fontext='afm') File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 559, in createFontList font = afm.AFM(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 305, in __init__ parse_afm(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 293, in parse_afm dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 177, in _parse_char_metrics name = vals[2].split()[1] IndexError: list index out of range Sigh. I'm sure it's as frustrating for you as it is for me. Thanks, Rich -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Tue, 25 Oct 2011, Paul Ivanov wrote: Well, I hope the dentist trip was more of a success :) Don't worry about it - it's become kind of a fun challenge now. Paul, Yes, it was a nice, long, relaxing visit. I go to the dental school at the health sciences university; costs ~ 1/3rd less than a private dentist, top-notch care, and the latest techniques when necessary. I see you sent this just a few minutes ago - let's try to figure this out interactively via IRC on #matplotlib channel on freenode. If you don't have an IRC client handy, you can just use this web-based one. http://webchat.freenode.net/?channels=matplotlib Oops! That was a while ago. I'm rather overwhelmed with client work, but will see if I still have an IRC tool available on the system; I removed bitchx a while ago. Rich -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py [RESOLVED]
On Tue, 25 Oct 2011, Paul Ivanov wrote: I see you sent this just a few minutes ago - let's try to figure this out interactively via IRC on #matplotlib channel on freenode. If you don't have an IRC client handy, you can just use this web-based one. http://webchat.freenode.net/?channels=matplotlib Paul, et al.: Changing underline to underline fixed the problem. Now I have some legacy database connection issues since pysqlite3 is now included with python. Ergo, no more matplotlib complaints! (I suppose that removing the kidsd.* font had nothing to do with it, but I don't use that font in any case.) Thanks very much, Rich -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Sun, 23 Oct 2011, Paul Ivanov wrote: Change my request to add 'sys.stderr.write(fh.name)' before the 'while 1:' in _parse_char_metrics - just so we don't have any buffering issues. The last file you see printed there will be the one that's causing the issue. You can then try removing it, or sending it back to the list (or both) so we can see what happened. Paul, The last file printed before the traceback is /usr/share/fonts/atmfonts/kidsm.afm. When I mv that to Xkidsn.afm it still shows up. I'm also seeing the same error in a number of other atmfonts. Some in /usr/X11/lib/X11/fonts/atmfonts, which is a soft link to /usr/share/fonts/atmfonts, and other errors in the soft links in ~/.fonts/atmfonts. Would you like a copy of kidsn.afm? Thanks, Rich -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 24 Oct 2011, Paul Ivanov wrote: Would you like a copy of kidsn.afm? sure. let's take a look. StartFontMetrics 2.0 Comment Kids-Normal Comment Copyright (c) 1992 Corel Corporation. All Rights Reserved. Comment Creation Date: Mon Jun 15 12:00:00 1992 Comment UniqueID 5029202 Comment VMUsage 2 2 FontName Kids-Normal FullName Kids Normal FamilyName Kids Weight Normal ItalicAngle 0 IsFixedPitch false FontBBox -188 -268 1227 980 Underline Position -100 Underline Thickness 50 Version 001.00 Notice Copyright (c) 1992 Corel Corporation. All Rights Reserved. EncodingScheme StandardEncoding CapHeight 811 XHeight 590 Ascender 742 Descender -193 StartCharMetrics 210 C 32 ; WX 225 ; N space ; B 0 0 0 0 ; C 33 ; WX 225 ; N exclam ; B 53 0 207 752 ; C 34 ; WX 262 ; N quotedbl ; B 64 506 246 730 ; C 35 ; WX 773 ; N numbersign ; B 6 14 715 752 ; C 36 ; WX 631 ; N dollar ; B -21 -94 537 824 ; C 37 ; WX 807 ; N percent ; B 31 -27 746 756 ; C 38 ; WX 770 ; N ampersand ; B 10 -68 709 777 ; C 39 ; WX 270 ; N quoteright ; B 57 436 240 760 ; C 40 ; WX 383 ; N parenleft ; B 55 -123 328 746 ; C 41 ; WX 391 ; N parenright ; B 0 -145 287 725 ; C 42 ; WX 348 ; N asterisk ; B 68 469 326 740 ; C 43 ; WX 615 ; N plus ; B 41 43 559 547 ; C 44 ; WX 270 ; N comma ; B 72 -166 225 111 ; C 45 ; WX 305 ; N hyphen ; B 25 264 277 344 ; C 46 ; WX 199 ; N period ; B 88 -47 213 107 ; C 47 ; WX 363 ; N slash ; B 47 -115 324 727 ; C 48 ; WX 588 ; N zero ; B -8 8 535 721 ; C 49 ; WX 297 ; N one ; B 137 16 270 764 ; C 50 ; WX 633 ; N two ; B 18 -20 561 742 ; C 51 ; WX 492 ; N three ; B 43 -21 439 695 ; C 52 ; WX 537 ; N four ; B 6 10 496 721 ; C 53 ; WX 625 ; N five ; B 0 8 557 814 ; C 54 ; WX 604 ; N six ; B 16 -6 529 742 ; C 55 ; WX 494 ; N seven ; B 64 -8 459 746 ; C 56 ; WX 605 ; N eight ; B 61 -14 533 758 ; C 57 ; WX 549 ; N nine ; B 29 -90 508 760 ; C 58 ; WX 186 ; N colon ; B 88 -47 232 525 ; C 59 ; WX 229 ; N semicolon ; B 72 -166 232 525 ; C 60 ; WX 605 ; N less ; B 37 6 551 555 ; C 61 ; WX 574 ; N equal ; B 59 164 533 441 ; C 62 ; WX 582 ; N greater ; B 33 23 547 568 ; C 63 ; WX 582 ; N question ; B 66 -47 555 744 ; C 64 ; WX 1033 ; N at ; B 20 -6 887 787 ; C 65 ; WX 799 ; N A ; B 27 10 730 742 ; C 66 ; WX 664 ; N B ; B 27 -47 551 744 ; C 67 ; WX 795 ; N C ; B 27 -25 717 773 ; C 68 ; WX 816 ; N D ; B -2 -49 703 764 ; C 69 ; WX 549 ; N E ; B 45 -86 508 715 ; C 70 ; WX 563 ; N F ; B 51 -21 516 773 ; C 71 ; WX 916 ; N G ; B 20 0 807 795 ; C 72 ; WX 768 ; N H ; B -16 -33 672 811 ; C 73 ; WX 496 ; N I ; B -88 -6 342 738 ; C 74 ; WX 453 ; N J ; B -4 4 408 766 ; C 75 ; WX 607 ; N K ; B 51 -84 541 717 ; C 76 ; WX 535 ; N L ; B 25 -8 494 717 ; C 77 ; WX 869 ; N M ; B 66 -105 813 787 ; C 78 ; WX 766 ; N N ; B 59 8 729 799 ; C 79 ; WX 844 ; N O ; B 33 23 783 830 ; C 80 ; WX 580 ; N P ; B -21 -12 504 777 ; C 81 ; WX 895 ; N Q ; B 20 -68 803 740 ; C 82 ; WX 586 ; N R ; B 35 -37 549 764 ; C 83 ; WX 635 ; N S ; B -41 -12 533 770 ; C 84 ; WX 605 ; N T ; B -45 27 482 836 ; C 85 ; WX 631 ; N U ; B 23 -20 596 797 ; C 86 ; WX 732 ; N V ; B 25 -18 678 734 ; C 87 ; WX 947 ; N W ; B 12 -37 877 725 ; C 88 ; WX 656 ; N X ; B 0 -72 588 740 ; C 89 ; WX 596 ; N Y ; B 43 0 545 762 ; C 90 ; WX 713 ; N Z ; B -49 6 594 750 ; C 91 ; WX 430 ; N bracketleft ; B 47 -107 395 760 ; C 92 ; WX 527 ; N backslash ; B 98 -18 484 768 ; C 93 ; WX 342 ; N bracketright ; B -23 -123 271 756 ; C 94 ; WX 574 ; N asciicircum ; B 16 293 535 775 ; C 95 ; WX 590 ; N underscore ; B -27 -127 514 -25 ; C 96 ; WX 262 ; N quoteleft ; B 45 434 229 760 ; C 97 ; WX 684 ; N a ; B 31 -43 633 539 ; C 98 ; WX 711 ; N b ; B 0 0 629 879 ; C 99 ; WX 771 ; N c ; B 21 -23 676 576 ; C 100 ; WX 672 ; N d ; B 59 29 631 826 ; C 101 ; WX 688 ; N e ; B 25 -63 629 559 ; C 102 ; WX 416 ; N f ; B 6 -35 363 779 ; C 103 ; WX 658 ; N g ; B 25 -213 607 650 ; C 104 ; WX 604 ; N h ; B 23 6 549 799 ; C 105 ; WX 193 ; N i ; B 10 43 174 773 ; C 106 ; WX 424 ; N j ; B -104 -201 238 758 ; C 107 ; WX 521 ; N k ; B 47 -4 473 775 ; C 108 ; WX 230 ; N l ; B 49 4 211 764 ; C 109 ; WX 949 ; N m ; B 10 23 875 600 ; C 110 ; WX 627 ; N n ; B 10 0 553 557 ; C 111 ; WX 688 ; N o ; B 39 -4 615 555 ; C 112 ; WX 660 ; N p ; B 27 -203 617 561 ; C 113 ; WX 742 ; N q ; B 92 -229 693 549 ; C 114 ; WX 400 ; N r ; B 33 2 367 586 ; C 115 ; WX 500 ; N s ; B -47 -14 406 580 ; C 116 ; WX 406 ; N t ; B -14 37 352 809 ; C 117 ; WX 570 ; N u ; B 72 -51 541 566 ; C 118 ; WX 605 ; N v ; B -4 -14 543 574 ; C 119 ; WX 896 ; N w ; B 16 -18 832 582 ; C 120 ; WX 525 ; N x ; B 27 49 480 590 ; C 121 ; WX 578 ; N y ; B 12 -193 520 547 ; C 122 ; WX 561 ; N z ; B -63 -47 443 553 ; C 123 ; WX 303 ; N braceleft ; B 20 -63 264 760 ; C 124 ; WX 393 ; N bar ; B 277 -45 375 693 ; C 125 ; WX 273 ; N braceright ; B 55 -68 244 707 ; C 126 ; WX 586 ; N asciitilde ; B 39 219 531 408 ; C 127 ; WX 262 ; N ; B 64 506 246 730 ; C 128 ; WX 324 ; N grave ; B 63 615 301 785 ; C 129 ; WX 475 ; N circumflex ; B 92 607 438 750 ; C 130 ; WX 393 ; N tilde ; B 68 617 361
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 24 Oct 2011, Paul Ivanov wrote: so no more tracebacks? Don't know. I'm processing accounts payable, beating up a client who's late paying an invoice, trying to figure out which R package/function I need, and more. It's been a rather crappy day, if you must know the truth. :-) I'll try again tomorrow morning before I head to the dentist. Well, that's a mystery... why did you previously see a Found an unknown keyword in AFM header (was Underline) message for it... You ask moi? I've no idea at all! That's why I count on you experts to tell me why. :-) Thanks much, Paul, Rich -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Fri, 21 Oct 2011, Paul Ivanov wrote: Is there a particular reason you just upgraded to a version of matplotlib that is almost 2 years old now? Matplotlib 1.1.0 was released a few weeks ago, Paul, Yes, the reason was 0.99.1.2 was on the SlackBuilds.org site, so I didn't check to see if it was the current version. ... so it's strange that you did not upgrade to it, or at least to 1.0.1, which came out in January. I just did: 1.1.0 is now installed, but I still have the same problem trying to run my model. I'm not certain that the issue you're running into has been fixed, but there have certainly been lots of changes. I also want to make sure that there isn't some stale pointer to an old version of matplotlib out there - so can you let us know what procedure you used to do the upgrade? I modified the matplotlib.SlackBuild script to remove the old patch and the non-existant file names INTERACTIVE and KNOWN_BUGS. It built and upgraded just fine. Ben's been helping by asking for information that might assist in isolating the source of the problem. Since I am now using version 1.1.0 I'll resend the error report. There are multiple lines reading: Found an unknown keyword in AFM header (was Underline) followed by the traceback: Traceback (most recent call last): File ./eikos.py, line 6, in module from modelPage import modModel File /home/rshepard/development/trunk/modelPage.py, line 9, in module from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas File /usr/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py, line 20, in module from matplotlib.figure import Figure File /usr/lib/python2.6/site-packages/matplotlib/figure.py, line 18, in module from axes import Axes, SubplotBase, subplot_class_factory File /usr/lib/python2.6/site-packages/matplotlib/axes.py, line 14, in module import matplotlib.axis as maxis File /usr/lib/python2.6/site-packages/matplotlib/axis.py, line 10, in module import matplotlib.font_manager as font_manager File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 1323, in module _rebuild() File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 1273, in _rebuild fontManager = FontManager() File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 997, in __init__ self.afmlist = createFontList(self.afmfiles, fontext='afm') File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 559, in createFontList font = afm.AFM(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 304, in __init__ parse_afm(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 292, in parse_afm dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 176, in _parse_char_metrics name = vals[2].split()[1] IndexError: list index out of range I will certainly add diagnostic code requested by you, Ben, and anyone else and report the results when trying to run the model. I do need to fix this and have no idea what's behind the problem. Thanks, Rich -- The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 0.99.1.2: error in afm.py
After a long hiatus I'm again working on an application and just upgraded matplotlib from 0.98.5.2 to 0.99.1.2. However, there's an error on start up that I need your help in resolving. There are many dozens of lines containing: Found an unknown keyword in AFM header (was Underline) The traceback (in its entirety) shows: Traceback (most recent call last): File ./eikos.py, line 6, in module from modelPage import modModel File /home/rshepard/development/trunk/modelPage.py, line 8, in module from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas File /usr/lib/python2.6/site-packages/matplotlib/backends/backend_wxagg.py, line 20, in module from matplotlib.figure import Figure File /usr/lib/python2.6/site-packages/matplotlib/figure.py, line 18, in module from axes import Axes, SubplotBase, subplot_class_factory File /usr/lib/python2.6/site-packages/matplotlib/axes.py, line 12, in module import matplotlib.axis as maxis File /usr/lib/python2.6/site-packages/matplotlib/axis.py, line 10, in module import matplotlib.font_manager as font_manager File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 1301, in module _rebuild() File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 1292, in _rebuild fontManager = FontManager() File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 1010, in __init__ self.afmlist = createFontList(self.afmfiles, fontext='afm') File /usr/lib/python2.6/site-packages/matplotlib/font_manager.py, line 578, in createFontList font = afm.AFM(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 295, in __init__ parse_afm(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 283, in parse_afm dcmetrics_ascii, dcmetrics_name = _parse_char_metrics(fh) File /usr/lib/python2.6/site-packages/matplotlib/afm.py, line 167, in _parse_char_metrics name = vals[2].split()[1] IndexError: list index out of range Please tell me what I need to do to resolve this error. Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 17 Oct 2011, Benjamin Root wrote: In the afm.py file, a before line 167, can you print the value of the line variable and tell us what it is? Ben, Here are lines 158-167: while 1: line = fh.readline() if not line: break line = line.rstrip() if line.startswith('EndCharMetrics'): return ascii_d, name_d vals = line.split(';')[:4] if len(vals) !=4 : raise RuntimeError('Bad char metrics line: %s' num = _to_int(vals[0].split()[1]) wx = _to_float(vals[1].split()[1]) name = vals[2].split()[1] Thanks, Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 17 Oct 2011, Benjamin Root wrote: On line 166, I want you to put print 'Line:', line. Then, rerun your program and report back what the output of that print statement. Ben, Sorry I mis-understood your request. I redirected the output to a file 'error.log' and it contains 104,777 lines from the 'print line' command. I can gzip it and send it to you off the list but it's 5.5M in size. When I grep for Underline in error.log it's not found. That seems to be the unknown keyword. How would you like me to proceed? Thanks, Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 0.99.1.2: error in afm.py
On Mon, 17 Oct 2011, Benjamin Root wrote: I only need the last line printed by that print statement. I want to see how the parsing failed. Ben, Here are the last 3: Line: C 125 ; WX 273 ; N braceright ; B 55 -68 244 707 ; Line: C 126 ; WX 586 ; N asciitilde ; B 39 219 531 408 ; Line: C 127 ; WX 262 ; N ; B 64 506 246 730 ; I see there's no character in the last line. Isn't that interesting! Rich -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plots Not Properly Closed
I have three unresolved issues in the attached code, and I'd like to resolve the first two on this thread. (The third issue relates to plotting using only the left and bottom axes rather than a complete frame.) Issue #1: I am apparently not properly closing/clearing a plot. There are three plots in the test data set, and when the last one (with three curves on a common set of axes) is the only one plotted, it is correctly done. But, when it follows the 2-curve plots, they are also displayed. I probably am turning .hold() off and on in the wrong places, but I don't know where the right places are. On a side note, if I try to use plot.hold() to toggle the hold state off python throws an error. I need to explicitly use plot.hold(False). Issue #2: Is there a way to define the parameters for the Gaussian curve so the end points are actually 0.0 on the y axis while the mid point is as specified? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863#!/usr/bin/env python import os, config, testFunctions import matplotlib import matplotlib.numerix as nx import pylab varData =[(Low,Variety,Fish,Wildlife,Decay S-Curve,1,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (High,Variety,Fish,Wildlife,Growth S-Curve,2,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (Low,Variety,Terrestrial,Wildlife,Decay S-Curve,1,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (High,Variety,Terrestrial,Wildlife,Growth S-Curve,2,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (Low,HabitatComplexity,Fish,Wildlife,Decay S-Curve,1,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (High,HabitatComplexity,Fish,Wildlife,Growth S-Curve,2,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (Low,HabitatComplexity,Terrestrial,Wildlife,Decay S-Curve,1,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (High,HabitatComplexity,Terrestrial,Wildlife,Growth S-Curve,2,0.0,100.0,0.0,100.0,0.0,100.0,50.0,50.0,100.0,1.0,2), (Low,SpecialConcern,Fish,Wildlife,Decay S-Curve,1,0.0,100.0,0.0,50.0,0.0,50.0,50.0,0.0,50.0,1.0,3), (Moderate,SpecialConcern,Fish,Wildlife,Bell Curve,2,0.0,100.0,0.0,100.0,0.0,50.0,50.0,50.0,50.0,1.0,3), (Many,SpecialConcern,Fish,Wildlife,Growth S-Curve,3,50.0,100.0,50.0,50.0,0.0,100.0,50.0,100.0,50.0,1.0,3)] def testCode(): for row in varData: curComp = row[3] curSub = row[2] curVar = row[1] plotting = True if plotting: pylab.hold(True) if row[4] == 'Decay S-Curve': testFunctions.zCurve(row[10],row[9]) elif row[4] == 'Bell Curve': testFunctions.gaussCurve(row[13],row[14]) elif row[4] == 'Growth S-Curve': testFunctions.sCurve(row[8],row[11]) elif row[4] == 'Beta': testFunctions.betaCurve(row[13],row[12],row[14]) elif row[4] == 'Data': continue elif row[4] == 'Linear Increasing': testFunctions.linearIncrCurve(row[8],row[11]) elif row[4] == 'Linear Decreasing': testFunctions.linearDecrCurve(row[10],row[9]) elif row[4] == 'Left Shoulder': testFunctions.leftShoulderCurve(row[10],row[11],row[9]) elif row[4] == 'Trapezoid': testFunctions.trapezoidCurve(row[8],row[10],row[11],row[9]) elif row[4] == 'Right Shoulder': testFunctions.rightShoulderCurve(row[8],row[10],row[11]) elif row[4] == 'Triangle': testFunctions.triangleCurve(row[8],row[13],row[9]) elif row[4] == 'Singleton': testFunctions.singletonCurve(row[13],row[14]) elif row[4] == 'Rectangle': testFunctions.rectangleCurve(row[8],row[10],row[11],row[9]) elif row[4] == 'Outcome': testFunctions.outcomeCurve() if row[5] == row[16]: pylab.savefig(curVar+'_'+curSub+'_'+curComp+'.png') pylab.hold(False) plotting = False if __name__ == __main__: testCode() #!/usr/bin/env python import os, sys, wx, config import matplotlib import matplotlib.numerix as nx import pylab as p from numpy import linalg from math import * from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg from matplotlib.figure import Figure matplotlib.interactive(False) def fwhm2k(fwhm): # for matplotlib Gaussian and Singleton curves Converts fwhm value to k (see above) return fwhm/(2 * nx.sqrt(nx.log(2))) def gauss1d(r, fwhm, center): Returns the 1d gaussian given by fwhm (full-width at half-max), and c (center) at positions given by r return nx.exp(-(r-center)**2 / fwhm2k(fwhm)**2) def boltzman(x, xmid, tau): Evaluate the boltzman function with midpoint, xmid, and time constant tau over x return 1.0 / (1.0 + nx.exp(-(x-xmid)/tau)) # -- def gaussCurve(midpt, width): center = midpt fwhm = width x = nx.arange(0, 100,
Re: [Matplotlib-users] Plots Not Properly Closed -- Partially Resolved
On Sat, 22 Mar 2008, Rich Shepard wrote: Issue #1: I am apparently not properly closing/clearing a plot. There are three plots in the test data set, and when the last one (with three curves on a common set of axes) is the only one plotted, it is correctly done. But, when it follows the 2-curve plots, they are also displayed. Fixed: I discovered .close() and added that to the end of each plot's content. Still need advice on #2. Issue #2: Is there a way to define the parameters for the Gaussian curve so the end points are actually 0.0 on the y axis while the mid point is as specified? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Why Is This Code Failing?
On Wed, 19 Mar 2008, Rich Shepard wrote: When it runs in the test script the first curve is plotted in a matplotlib window and the program pauses until I close that window by clicking on the upper right button on the frame. Then this traceback is displayed: Update: I stripped the test data file down to a single plot's worth. Tried different tuples in the data so different plotting functions were called. I have pylab.hold(True) as the first statement in the for loop, and now -- with the single plot data -- there is no error trace. However, the code still displays the first curve of the three until I manually close the matplotlib display window. Then the code proceeds to open a new window and draw all three curves, then close itself after the save() command. I've no idea how to clean up the drawing of the first curve and the pause until that window is manually closed. Nothing I've read in the docs or on the web site give me any clues. Clue appreciated. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Specifiying Axes and Grid Lines
I've read the users guide and API (both as pdf and on the web site), and do not see how to configure the axes for only left and bottom, and the grid for only horizontal lines. The axes(rect, w) is used to specify the position of the left and bottom lines plus the width and height of the box. What do I put in ~/.matplotlib/matplotlibrc to specify no top or right axes, and no vertical grid lines? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Why Is This Code Failing? -- FIXED
On Thu, 20 Mar 2008, Rich Shepard wrote: Clue appreciated. Bingo! Found the problem. The plotting functions are in a separate module, and each was developed interactively using ipython, then copied into the module. As a result, each function retained the show() command at the end, and that was interfering with the intent of the programmatic generation. Commenting out the p.show() command removes the display, but the stored .png is there. Whew! Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Why Is This Code Failing?
Here is the relevant code fragment: for i in range(1, compList[0][16]): pylab.hold(True) if compList[0][4] == 'Decay S-Curve': testFunctions.zCurve(compList[0][10],compList[0][9]) elif compList[0][4] == 'Bell Curve': testFunctions.gaussCurve(compList[0][14],compList[0][14]) elif compList[0][4] == 'Growth S-Curve': testFunctions.sCurve(compList[0][8],compList[0][11]) elif compList[0][4] == 'Beta': testFunctions.betaCurve(compList[0][13],compList[0][12],compList[0][14]) elif compList[0][4] == 'Data': continue elif compList[0][4] == 'Linear Increasing': testFunctions.linearIncrCurve(compList[0][8],compList[0][11]) elif compList[0][4] == 'Linear Decreasing': testFunctions.linearDecrCurve(compList[0][10],compList[0][9]) elif compList[0][4] == 'Left Shoulder': testFunctions.leftShoulderCurve(compList[0][10],compList[0][11],compList[0][9]) elif compList[0][4] == 'Trapezoid': testFunctions.trapezoidCurve(compList[0][8],compList[0][10],compList[0][11],compList[0][9]) elif compList[0][4] == 'Right Shoulder': testFunctions.rightShoulderCurve(compList[0][8],compList[0][10],compList[0][11]) elif compList[0][4] == 'Triangle': testFunctions.triangleCurve(compList[0][8],compList[0][13],compList[0][9]) elif compList[0][4] == 'Singleton': testFunctions.singletonCurve(compList[0][13],compList[0][14]) elif compList[0][4] == 'Rectangle': testFunctions.rectangleCurve(compList[0][8],compList[0][10],compList[0][11],compList[0][9]) elif compList[0][4] == 'Outcome': testFunctions.outcomeCurve() pylab.savefig(curVar+'.png') pylab.hold() When it runs in the test script the first curve is plotted in a matplotlib window and the program pauses until I close that window by clicking on the upper right button on the frame. Then this traceback is displayed: Traceback (most recent call last): File termset-test-data.py, line 391, in ? testCode() File termset-test-data.py, line 388, in testCode pylab.hold() File /usr/lib/python2.4/site-packages/matplotlib/pyplot.py, line 334, in hold rc('axes', hold=b) File /usr/lib/python2.4/site-packages/matplotlib/pyplot.py, line 74, in rc matplotlib.rc(*args, **kwargs) File /usr/lib/python2.4/site-packages/matplotlib/__init__.py, line 712, in rc rcParams[key] = v File /usr/lib/python2.4/site-packages/matplotlib/__init__.py, line 552, in __setitem__ cval = self.validate[key](val) File /usr/lib/python2.4/site-packages/matplotlib/rcsetup.py, line 43, in validate_bool raise ValueError('Could not convert %s to boolean' % b) ValueError: Could not convert None to boolean What I want is to have all curves from 1 to the maximum number (in compList[0][16]) plotted on the same set of axes, then save that figure and go on to the next one. Is my problem an indentation error at the end of the IF...ELIF tests? TIA, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Debugging: Many Multiple Plots -- Update
On Tue, 18 Mar 2008, Rich Shepard wrote: File termset-test-data.py, line 389, in testCode pylab.hold() Replacing the line above with pylab.hold(False) seems to put me in a non-stop loop. I'll run the test code in winpdb, but still want suggestions on how to get the output I need. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Major Issue with 0.91.2 and Python-2.5
I upgraded my notebook to Slackware-12.0 (which includes python-2.5) and discovered that the application I'm developing no longer ran. Turns out that matplotlib went missing during the upgrade. So, I just built matplotlib-0.91.2 using the same matplotlib.Slackbuild script I used on my workstation/server, but this time it failed. The font manager seems to be the issue; the error message repeatedly is: Found an unknown keyword in AFM header (was Underline). Specifically, the error is in File /usr/lib/Python2.5/site-packages/matplotlib/afm.py, line 166, in _parse_char_metrics name=vals[2].split()[1] IndexError: List index out of range Is this unique to me? What do I do to fix the problem? TIA, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pylab.save() File Name Syntax
On Fri, 1 Feb 2008, Stephen George wrote: bit confused what your asking. are you looking for the pylab API savefig Stephen/Alan/Chloe: Yes, it turns out that I am. or you asking how to convert your variable+.png into a filename? is your variable a number?, string? The variable is a string, and I do want to use it as a file name. pylab.savefig('%s.png'% curVar) I wasn't aware of the savefig() function, and was trying to use save() instead. As soon as I made that change, it worked. Thanks for the lesson! Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Warning After Upgrade to -0.91.2
On Fri, 1 Feb 2008, Eric Firing wrote: What changed is that I added a warning where previously there was only a silent error--the matplotlib.use command was being ignored. Sometimes this (ignoring the command) is harmless, but it is never the user's intent and in some cases it can cause puzzling problems. It often occurs when a script or module does from pylab import * or import pylab as P, and then later import matplotlib; matplotlib.use('Agg'). In this example, the user intends to make plots non-interactively, writing them to files, but the whole gui machinery for the default backend (e.g., gtkagg or wxagg or tkagg) is imported unintentionally. Eric, Thanks for the explanation. And you bring up another issue that I have: the most appropriate way to generate non-interactive plots, written to files, for inclusion in a ReportLab report. Do I want to use pylab for this, plots embedded in wx, or something else? I need to get this module running properly so I am focusing on really understanding how to use matplotlib to produce what we need. One way to find out where the warning is coming from is to invoke your script as python -Werror myscript.py which will turn the warning into an error and thereby trigger an exception traceback. OK. Tomorrow morning I'll do this. What this will *not* tell you is where the *earlier* call to matplotlib.use() is occurring. To find it you will have to trace back through your application, looking for the first place where pylab, matplotlib.pyplot, or matplotlib.backends is imported, or the first explicit use of matplotlib.use(), whichever is earliest. There are two modules in which pylab is used: reports.py and functions.py. The former calls specific matplotlib functions in the latter. On the other hand, matplotlib is imported in several modules. Perhaps that's the problem. I'll check this tomorrow, too. Thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Warning After Upgrade to -0.91.2
On Fri, 1 Feb 2008, Eric Firing wrote: One way to find out where the warning is coming from is to invoke your script as python -Werror myscript.py Eric, That did the trick. Two modules needed to have the backend specification commented out. Many thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] pylab.save() File Name Syntax
I want to save plots programmatically, using a variable + .png as the filename. I don't see an example of the proper syntax, and my trial-and-error approach hasn't yielded a solution, either. If I want to write pylab.save(curVar.png) where 'curVar' is a variable assigned programmatically, how do I correctly write it? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Creating Plots for Inclusion in ReportLab PDF
I'm hoping that someone's already addressed the need I have so I don't need to re-invent this wheel. But, if no one has a ready-made solution, I still need some expert advice in how to build this wheel myself. My python application uses the wxPython widget library, SQLite (using the pysqlite2 library), ReportLab for the reports, and matplotlib for data plotting. Right now my attention is on writing the function(s) that plot multiple curves on a common axes set for inclusion in a PDF report. I've been struggling with this for several days without tripping over the solution. Here's what I'm trying to do, using a town for an analogy. The data on towns, streets, and houses are stored in database tables. What I want are plots of all house shapes on each street in each town, in .png format for inclusion in the ReportLab output. There can be from 1 to 7 houses per street, and the shapes are defined as distribution curves (e.g., Bell, S-, Z-, trapezoidal curves). In pseudocode, this is what I have: for each town: for each street: hold(True) if shape == 'first shape': call functions.firstShape() if shape == 'second shape': call functions.secondShape() etc. hold() This does not work. First, 'hold()' is not known in this module, but all appropriate matplotlib components are imported. Second, I must not have the functions correctly written; for example, this error: File /data1/eikos/reports.py, line 421, in inputVals functions.leftShoulderCurve(self.row[10],self.row[11],self.row[9]) File /data1/eikos/functions.py, line 542, in leftShoulderCurve p.plot(x, y, color='red', lw=2) NameError: global name 'p' is not defined And here is functions.leftShoulderCurve: def leftShoulderCurve(hl, hr, lr): hiLeft = hl hiRight = hr lowRight = lr x, y = zip(*[(hiLeft, 1.0), (hiRight, 1.0), (lowRight, 0.0)]) p.plot(x, y, color='red', lw=2) p.axis([0, 100, 0.0, 1.0]) p.xlabel('Universe of Discourse') p.ylabel('Membership Grade') p.show() If I add instance reference of 'self' prepended to 'p.', that throws the same error. What I need is guidance on where to start to be able to produce these plots. (Display of individual curves will be addressed after I get the report completed.) TIA, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plotting Multiple Curves on Same Axes; Save as .jpg
I've looked at all the docs I can find on the matplotlib web site without finding the answers to two questions. Pointers to references are greatly appreciated. 1) I want to plot a series of curves on the same set of axes. For example, shoulder- and trapezoidal curves: ___ __ ___ | \/ \/ |\ /\ / | \/ \/ | \ /\ / | \/ \/ | /\ /\ | / \/ \ | /\ /\ |/ \/ \ |___/\__/\___ With labels and text, of course. Each curve represents values in a separate row of the database table. How do I specify that subsequent curves are to be plotted on the same axes as the first one? 2) When each plot is created I want to save it as a .jpg file so it can be included in a ReportLab report. Do I specify the filename and extension in the save() command, or is there a different way? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Multiple Curves on Same Axes; Save as .jpg
On Mon, 7 Jan 2008, Darren Dale wrote: you can call hold(True) so each call to plot() adds a new curve to the axes. Darren, Excellent! Where is this documented, please? I did not see it when I looked in the docs. Agg does not produce jpg. Can you live with a png? png are not lossy and so they yield much nicer line art than jpgs. Just give your filename a .png extension and save will recognize the format. Yes, a .png image can be incorporated into a .pdf file as easily as can a .jpg impage. Thank you very much, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Multiple Curves on Same Axes; Save as .jpg
On Mon, 7 Jan 2008, John Hunter wrote: The function is document http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-hold and the usage in the Simple Plots Section 3.1 of the User's Guide at http://matplotlib.sourceforge.net/users_guide_0.91.2svn.pdf . The hold functionality is part of the state-machine interface inherited from matlab, where plotting commands are targets to the current axes in the current figure, and overbplotting is controlled by the hold state. Se also, ishold Thank you John and Darren. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] printing quality
On Mon, 3 Dec 2007, Michael Droettboom wrote: That may be beyond matplotlib's control. Matplotlib requests a solid grey color, but the printing stack (Acrobat, the printer driver or the printer itself) could be interpreting that in many ways. You could experiment with various printer settings. Sorry to not have a more helpful answer. Perhaps others on this list have suggestions. Don't know if this is pertinent to this thread, but I see differences when viewing LaTeX documents such as an OMR (Optical Mark Reader) form I designed when viewed as PostScript and as PDF. The former displays the graphics better than does the latter while the latter better displays the text. In my case, the printed version combines the highest quality of the two. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Wanted: recommendations on embedding matplotlib in a wxPython application
On Mon, 26 Nov 2007, C M wrote: Basically what I did (sorry if this is too basic, but I'm pretty new to this and this may jog others to correct deficiencies in this simple approach) was to: This is all straightforward and clear. The one statement I've not yet understood is this: self.graph = matplotFrame3.PlotPanel(self.panel1,xpoints, ypoints) I assume that matplotFrame3 is the name of the module in which you've written PlotPanel(). Is this assumption correct? I'm modifying your approach to suit our application but it seems to be the most parsimonious and elegant solution for simple display of plots in a wxPython panel. Thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Grid Display
Two questions relating to the display of grid lines in a plot: 1) Can this be controlled programmatically rather than from within ~/.matplotlib/matplotlibrc? 2) Is there a way to display horizontal grid lines without vertical grid lines? Pointers to the docs where these questions are answered would be adequate. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Grid Display
On Tue, 27 Nov 2007, Michael Droettboom wrote: You can get the axes through the Figure instance. (I don't know how you have your embedding set up, but if it's something like embedding_in_wx.py, there's the line self.fig = Figure((9, 8), 75), so self.fig is a Figure instance). Thanks, Mike. As I'm just starting with matplotlib I need to climb the learning curve as quickly as I can. Thanks for the pointers, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Grid Display
On Tue, 27 Nov 2007, Eric Firing wrote: Or just keep track of the axes object when it is created. In embedding_in_wx.py: def plot_data(self): # Use ths line if using a toolbar a = self.fig.add_subplot(111) a is the axes instance. Eric, Thanks. I had not picked that up. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Grid Display
On Tue, 27 Nov 2007, Anthony Floyd wrote: Check the class library documentation for the axes() object. http://matplotlib.sourceforge.net/matplotlib.axes.html Anthony, I've looked at this but didn't absorb it all. Now I'll spend more time with it. Your best bet is really to explore the object set in the class reference docs. That I will. Thanks very much, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots
On Mon, 26 Nov 2007, Christopher Barker wrote: or better yet -- work with numpy arrays from the beginning: Chris, These values are retrieved from widgets on a notebook page and the plot will be used to display them on that tab. It would take more code to convert those values to a numpy array. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Wanted: recommendations on embedding matplotlib in a wxPython application
On Mon, 26 Nov 2007, Christopher Barker wrote: I think wxMPL is a good option. I think MPlot gives you nifty tools for editing the figure with a GUI, but I don't think you want that. Chris, Thank you. I'll go read about wxMPL then. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Wanted: recommendations on embedding matplotlib in a wxPython application
On Mon, 26 Nov 2007, C M wrote: So far in my experience, and as I was recommended, the simplest, easiest, most pragmatic approach has been to forgo MPlot or WxMpl and just embed directly in wxPython. That is the insight I seek. I've looked at the examples and the cookbook page ... This page http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx discusses the difference between direct embedding and using an embedding library, the key difference for you being this sentence: An *embedding library* saves you a lot of time and effort by providing plotting widgets that already support user interactions and other bells and whistles. But you don't want such bells and whistles. No, I don't need bells or whistles. There is a link on that page to this examplehttp://www.scipy.org/Matplotlib_figure_in_a_wx_panelof direct embedding with wx. I was able to start with this and adapt it to my needs. I've looked closely at this, and need to figure out how to translate it from a stand-alone example to working in my application. There's also a reference on that SciPy cookbook page to links to the OO API on the matplotlib FAQ page, but I've not found that link(s). I have the api.pdf but is that the OO one? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Specifying X,Y Pairs For Line Plots
I need to plot trapezoids as well as left- and right-shouldered straight line plots. If I specify separate lists for the x values and their corresponding y values, the plots are generated and displayed as needed. However, I cannot specify the points as a list of tuples and have matplotlib accept them. Example: x,y = [(15,0.0), (30,1.0), (70,1.0) (85,0.0)] p.plot (x,y) Yields: Traceback (most recent call last): File trapezoid.py, line 4, in ? x,y = [(15,0.0), (30,1.0), (70,1.0) (85,0.0)] TypeError: 'tuple' object is not callable I don't see how to do this in the User Guide, but I'm sure there must be a way. Please pass me a pointer on how to accomplish this. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots
On Sun, 25 Nov 2007, Darren Dale wrote: you need a , after that (70,1.0) Thanks, Darren. Not enough caffine, I guess. However, now I get: Traceback (most recent call last): File trapezoid.py, line 4, in ? x,y = [(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)] ValueError: too many values to unpack which tells me something is still not correct. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Specifying X,Y Pairs For Line Plots
On Sun, 25 Nov 2007, Jouni K Seppänen wrote: x,y = zip(*[(15.0, 0.0), (30.0, 1.0), (70.0, 1.0), (85.0, 0.0)]) Jouni, Thank you for pointing this out to me. I see that it's a builtin function similar to map that assembles the first element of each tuple into a list for the first variable, and the second element of each tuple into a list for the second variable. How useful for my plotting needs! Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Sat, 24 Nov 2007, Angus McMorland wrote: Looking at my reply, I realised this was rubbish - sorry about that. The fwhm is the difference between the two values of x that give Y = 0.5. Now that makes much more sense. Having control over the x values for the inflection point allows us to tune the curve shape to more precisely reflect the underlying semantics. The additional explanation helps a lot. Great. Hopefully this correction will make things even more clear. I had scanned your previous response without looking deeply at it because I was not going to work on this until today in any case. For anyone curious about the context for my questions, it is an approximate reasoning (i.e., expert system) model using fuzzy sets and fuzzy logic. You can read all about it in my book, Quantifying Environmental Impact Assessments Using Fuzzy Logic, published in 2005 by Springer-Verlag. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Sat, 24 Nov 2007, Angus McMorland wrote: Great. Hopefully this correction will make things even more clear. While the functions and equations are now clear, I get an error that was present in matplotlib-0.87, but which should be fixed in -0.90.1: Traceback (most recent call last): File normal-curve.py, line 19, in ? G = gauss1d(x, fwhm, center) File normal-curve.py, line 16, in gauss1d return exp(-(r-center)**2 / fwhm2k(fwhm)**2) TypeError: only length-1 arrays can be converted to Python scalars According to /usr/lib/python2.4/site-packages/numpy/version.py, the installed version is 1.0b5. Do I have a version incompatibility here? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Sun, 25 Nov 2007, Angus McMorland wrote: I'm not completely sure, but I suspect that this is an implementation bug, rather than a version bug, particularly because the line in question isn't involving matplotlib at all. If you post the relevant code (normal-curve.py, by the looks of things), it might be easy to spot the problem. Angus, I've seen the same error trying to plot other curves in the past couple of days, but not those using the Boltzmann distribution. Here's the file: import matplotlib.numerix as nx import pylab as p from math import * center = 50.0 fwhm = 50.0 def fwhm2k(fwhm): '''converts fwhm value to k (see above)''' return fwhm/(2 * nx.sqrt(nx.log(2))) def gauss1d(r, fwhm, center): '''returns the 1d gaussian given by fwhm (full-width at half-max), and c (centre) at positions given by r ''' return exp(-(r-center)**2 / fwhm2k(fwhm)**2) x = nx.arange(0, 100, 0.1) G = gauss1d(x, fwhm, center) p.plot(x, G, color='red', lw=2) p.axis([0, 100, 0.0, 1.0]) p.xlabel('Universe of Discourse') p.ylabel('Membership Grade') p.show() I've found it easiest to solve these sorts of bugs by running the code in an ipython shell, with automatic pdb calling. That way you can inspect the values of the parameters in question - one of which is, I think, the problem here. I've not run ipython with pdb; I'll look at the docs to learn how. I do use winpdb on the application. Thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Sun, 25 Nov 2007, Angus McMorland wrote: As I suspected, this is a parameter issue- in this case caused by your use of the ath module routines which require scalar input, rather than numpy's (or matplotlib's numerix's) array-friendly versions. If you change exp - nx.exp in your definition of gauss1d, all works okay. Oh, d'oh! That's what I get for copying without closely examining the code. With more experience I'll learn the differences between the Python math functions and the equivalent ones from NumPy. Many thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Sun, 25 Nov 2007, Angus McMorland wrote: If you change exp - nx.exp in your definition of gauss1d, all works okay. Angus, Yes, it works just fine. By adjusting the value of the fwhm parameter I can produce the curves we need for both display and printing. Now I can spend some time tomorrow working out the functions for trapezoidal and shouldered curves (comparatively quite simple), learning how to embed them in a wxPython panel, and putting two, three, five, or seven curves on the same axes. The embedded wiki page and User Guide should provide what I need. My thanks to you and everyone else who responded. While I don't yet have sufficient knowledge to help others on this mail list, I do provide help on those lists where I've used the software for months or years and can answer questions posed by others. Perhaps I'll be doing that here, too, soon. Carpe weekend -- what's left of it, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Sat, 24 Nov 2007, Angus McMorland wrote: fwhm is the full-width at half the maximum height, i.e. it's the difference between the two values of x when: |r - c| = 0.5 Angus, The additional explanation helps a lot. The fwhm is a shape parameter (like std dev) - it determines the width of the curve. The combination of width and the range of values you plot (r) determine how close the function gets to zero, and how much of it is plotted. As Jeff said, it'll never actually reach zero, so you have to decide how close is close enough. You don't need to call fwhm2k yourself; it's called by the gauss1d function. I just do it that way because the equation uses k, but I'm always interested in fwhm. Ah, I missed seeing that. Perhaps the easiest thing is to shove it into some quick code and play around with the values so you see how it works: That's what I intend to do. I've been running ipython and also writing small scripts to understand how the functions work ... and plot. Playing with parameters clarifies everything. Much appreciated, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Thu, 22 Nov 2007, Rich Shepard wrote: For parsimony, I think you're probably best off just using the Gaussian equation: def fwhm2k(fwhm): '''converts fwhm value to k (see above)''' return fwhm/(2 * n.sqrt( n.log( 2 ) ) ) def gauss1d(r, fwhm, c): '''returns the 1d gaussian given by fwhm (full-width at half-max), and c (centre) at positions given by r ''' return exp( -(r-c)**2 / fwhm2k( fwhm )**2 ) Thank you, Angus. I'll look at the Gaussian explanation to understand the input values. It's been decades since I've needed to write any statistical or distributional function code; I used SysStat in DOS for quite some time and R for the past decade with linux. There's a great difference between using working code and writing one's one code. :-) Looking more carefully at the SciPy stats module, I see the normal distribution is included as a class. However, I don't understand all the functions in that class -- other than normal.pdf(x) -- and do not see where loc and scale (representing mean and std. deviation) are used. Toward understanding how to use this code to draw the curves I need, I extracted the one method into a stand-alone file and tried to plot a Normal/Bell curve from 0 to 100: import matplotlib.numerix as nx import pylab as p from math import * def normal(x): return exp(-x**2.0/2.0)/sqrt(2.0*pi) x = nx.arange(0, 100, 0.1) N = normal(x) p.plot(x, N, color='red', lw=2) p.axis([0, 100, 0.0, 1.0]) p.xlabel('Universe of Discourse') p.ylabel('Membership Grade') p.show() The error returned is: Traceback (most recent call last): File normal-curve.py, line 17, in ? N = normal(x) File normal-curve.py, line 14, in normal return exp(-x**2.0/2.0)/sqrt(2.0*pi) TypeError: only length-1 arrays can be converted to Python scalars A clue stick to the meaning of this error message, and how to fix the problem is needed. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plotting Continuous Functions
I see that I've been immortalized on the SciPy MatPlotLib Cookbook web page for my enquiry on plotting S- and Z-curves. The Boltzman function serves very well for that purpose, and I've tweaked the example code to allow me to pass in the two endpoints and the midpoint for each of these curves. Now I need to plot normal curves (a.k.a. Gaussian or bell curves, depending on the background of the speaker/writer). I see that SciPy has a class for the normal curve in its stats package, and that the curve shape is defined by the mean and standard deviation. My need is to draw these curves based on the midpoint (== mean) and tail endpoints (which are not the same as the s.d.). I can copy -- or call -- the SciPy class from my application code, but I don't know if this is the most parsimonious approach. Your thoughts are appreciated. These plots will be used in two different media, and it two forms. Within the wxPython application I want to display each curve on one panel, and the set of curves related to one linguistic variable on a second panel. Then I need to have the set incorporated into a ReportLab report in .pdf. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plotting Continuous Functions
On Fri, 23 Nov 2007, Angus McMorland wrote: For parsimony, I think you're probably best off just using the Gaussian equation: def fwhm2k(fwhm): '''converts fwhm value to k (see above)''' return fwhm/(2 * n.sqrt( n.log( 2 ) ) ) def gauss1d(r, fwhm, c): '''returns the 1d gaussian given by fwhm (full-width at half-max), and c (centre) at positions given by r ''' return exp( -(r-c)**2 / fwhm2k( fwhm )**2 ) Thank you, Angus. I'll look at the Gaussian explanation to understand the input values. The midpoint here is c. OK. It's not clear what you mean by endpoints - if you mean you want to be able to specify the y value at a given x delta-x away from c, then it should be relatively simple to solve the equation to find the required full-width at half-max to achieve these end-points. After a very quick look (i.e. definitely needs verification), I think What I mean is the x value where the tails of the curve have y == 0.0. These curves are defined by the range of x over which they are valid, and assume the midpoint is where y == 1.0 (the maximum value). The inflection points are at y = 0.5; in rare situations that may change. I hope that's what you're after. I'll look at it in detail tomorrow (my time) and the weekend. I, too, hope that it's what I need. Much appreciated, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Getting Started With 0.90.1
While I've had 0.82 installed on my workstation and notebook, I've not been ready to use it until now. I've just downloaded 0.90.1 and diff'd the two matplotlibrc files. Is WXAgg no longer supported as a backend if the plotting displays will be integral with the wxPython widget set? Also, why is everything in the rc file commented out? Are these all default values (lines, fill, etc.) and need to be specified only when different? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Libraries, Versions, and Confusion
I'm missing some understanding here, and cannot build matplotlib-0.90.1 nor the apparently missing libraries. This workstation is currently running Slackware-11.0 with the following installed (or missing, in the case of PyGObject): wxPython-2.8.0.1 wxGTK-2.8.0 pygobject: /usr/lib/pkgconfig/pygobject-2.0.pc; no PyGObject pygtk-2.10.3 Since I don't have a mental (or documented) map of how all the pieces fit together, I'm not sure how to fix the problems encountered. The matplotlib build fails because the compiler cannot find libraries that are present: In file included from /usr/include/bits/errno.h:25, from /usr/include/errno.h:36, from /usr/include/python2.4/Python.h:38, from src/_isnan.c:1: /usr/include/linux/errno.h:4:23: asm/errno.h: No such file or directory In file included from /usr/include/bits/errno.h:25, from /usr/include/errno.h:36, from /usr/include/python2.4/Python.h:38, from src/_isnan.c:1: /usr/include/linux/errno.h:4:23: asm/errno.h: No such file or directory error: Command gcc -pthread -fno-strict-aliasing -DNDEBUG -O3 -march=i486 -mtune=i686 -fPIC -I/usr/local/include -I/usr/include -I. -I/usr/include/python2.4 -c src/_isnan.c -o build/temp.linux-i686-2.4/src/_isnan.o failed with exit status 1 That is, /usr/include/linux/asm/error.h exists, and _isnan.c is present at /tmp/SBo/matplotlib-0.90.1/src/_isnan.c /usr/local/numpy/numpy/core/src/_isnan.c /usr/local/matplotlib-0.87.7/src/_isnan.c When I try to run matplotlib examples from within ipython, invoking the shell with the -pylab switch produces this error: File /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py, line 42, in ? raise ImportError( ImportError: PyGTK requires PyGObject 2.11.1 or higher, but () was found As noted above, I have the .pc file but that's all. I'd like guidance on how to fix this mess so I can build, learn, and use matplotlib-0.90.1. Once I understand the relationships involved, I'll be able to get the latest version built and running on my notebook which now runs Slackware-12.0 with Python-2.5.1. Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Libraries, Versions, and Confusion
On Wed, 21 Nov 2007, Rich Shepard wrote: I'm missing some understanding here, and cannot build matplotlib-0.90.1 nor the apparently missing libraries. This workstation is currently running Slackware-11.0 with the following installed (or missing, in the case of PyGObject): Got this resolved: turns out to be a highly unusual dependency on kernel headers earlier than those of the running kernel. However, why are all of the ~/.matplotlib/matplotlibrc options for LINES, PATCHES, FONT, etc. all commented out? Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Libraries, Versions, and Confusion
On Wed, 21 Nov 2007, Darren Dale wrote: They are all defaults. We prefer to ship default rc files that are commented out so it is easier to track down bugs, it makes it easier to keep track of any nonstandard settings. Darren, Thank you. I assumed that to be the case, but it's nice to have that confirmed. On the original issue, changing from the default GTKAgg to WXAgg removed all the GTK (cairo, libpangocairo) errors I was seeing. Since I want WXAgg as the default anyway, this works out nicely. Now to learn matplotlib for our application. I know I'll be back with questions. :-) Happy Thanksgiving, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: In your build environment, see if these directories show up with pkg-config --cflags-only-I pygtk-2.0 John, Nobody's home. That is what mpl uses to find your pygtk headers. If not, set your PKG_CONFIG_PATH environment variable accordingly, and make sure there is a pygtk-2.0.pc file in that directory. On my system it is in /usr/lib/pkgconfig/pygtk-2.0.pc and yours will probably be /usr/local/lib/pkgconfig Yes. That's just where it is. It looks like you did a local install of pygtk, but did not update the pkg-config path to point to it. Since I work on the main server/workstation, 'local' is a relative term. :-) Regardless, I added 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/' to .bash_profile and sourced that file. Did the same for root's .bash_profile. Now it's building. Many thanks, Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: You may also want to append /usr/local/pkgconfig/ to that path... John, pkgconfig is only in /usr/local/lib. Glad it's working for you. Well, let's not be too hasty. I replaced ~/.matplotlib/matplotlibrc with the newer copy from today's installation. Then I tried the simple script at the top of the tutorial: [EMAIL PROTECTED] ~]$ ipython Python 2.4.1 (#1, Apr 20 2005, 11:40:53) Type copyright, credits or license for more information. IPython 0.7.2 -- An enhanced Interactive Python. ? - Introduction to IPython's features. %magic - Information about IPython's 'magic' % functions. help- Python's own help system. object? - Details about 'object'. ?object also works, ?? prints more. In [1]: from pylab import * In [2]: plot([1,2,3,4]) Out[2]: [matplotlib.lines.Line2D instance at 0x4271874c] In [3]: show() Segmentation fault So, I must be missing something that's throwing an exception. Might you have suggestions where I should start looking? Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: sudo rm -rf your build dir and site-packages/matplotlib and rebuild/reinstall. John, Rats! That did not change the result. Is matplotlib-0.87.7 dependent on specific versions of gcc or glibc? Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, Simson Garfinkel wrote: Perhaps you have a second installation that you are not aware of. Good thought, Simon. I have the new /usr/local/matplotlib-0.87.7, /usr/share/matplotlib (with images and fonts), and another directory with docs and examples. That's all. There are no other copies of matplotlib except in the build directory and in ../site-packages/. Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: # How to diagnose where a segfault is occurring Try importing these packages individually [EMAIL PROTECTED] ~]$ ipython In [1]: import matplotlib._image In [2]: import matplotlib._transforms In [3]: import matplotlib.backends._ns_backend_agg In [4]: import matplotlib.backends._tkagg In [5]: import matplotlib._agg So far, so good. If that shed additional light, again flush the build and install dirs, and try setting VERBOSE=True in setup.py before doing a clean install. The VERBOSE setting will generate lots of extra output and may help indicate where the segfault is occurring Will do. Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: If that shed additional light, again flush the build and install dirs, and try setting VERBOSE=True in setup.py before doing a clean install. The VERBOSE setting will generate lots of extra output and may help indicate where the segfault is occurring Nothing different. No errors, but the same warnings that _POSIX_C_SOURCE is redefined, for example: gcc: src/_ns_image.cpp In file included from /usr/include/python2.4/Python.h:8, from src/_ns_image.cpp:8: /usr/include/python2.4/pyconfig.h:835:1: warning: _POSIX_C_SOURCE redefined In file included from /usr/include/c++/3.3.6/i486-slackware-linux/bits/os_defines.h:39, from /usr/include/c++/3.3.6/i486-slackware-linux/bits/c++config.h:35, from /usr/include/c++/3.3.6/iostream:44, from src/_ns_image.cpp:2: /usr/include/features.h:150:1: warning: this is the location of the previous definition Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: # How to diagnose where a segfault is occurring Try importing these packages individually import matplotlib._image import matplotlib._transforms import matplotlib.backends._ns_backend_agg # for numpy import matplotlib.backends._tkagg import matplotlib._agg All import without complaint. If that shed additional light, again flush the build and install dirs, and try setting VERBOSE=True in setup.py before doing a clean install. The VERBOSE setting will generate lots of extra output and may help indicate where the segfault is occurring No extra messages indicating any problems. I did discover that there were two pkgconfig/ directories. I moved the few newer *.pc files from /usr/local/lib/pkgconfig/ to /usr/lib/pkgconfig/, removed the now empty directory, and rebuilt/installed from the source tarball. No joy. It still segfaults when I try to 'show()' the plot. Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: If you recompiled cleanly (ie removed the build subdir) with VERBOSE=True as instructed, you should be getting tons and tons of output whenever you run a script (eg can you run simple_plot.py?). John, I was looking for verbose output during the build rather than when the script ran. Now I'm on the same page as you are. If you do get the output, post it along with the script and the command line. Also, try running with different backends, eg, PS, Agg. DO both segfault? simple_plot.py and the output (matplot.log) are attached. It is when the show() command is run that the problem appears. How do I specify the backend for a run of the script? Thanks, Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: I didn't see the attachment. John, Mea culpa! I forgot to stick them on. python myscript.py --verbose-debug -dAgg runagg.out python myscript.py --verbose-debug -dPS runps.out python myscript.py --verbose-debug -dGTK rungtk.out You may want to move this conversation over to the devel list. I just returned the subscription confirmation, and will append the output files in a response to that list. Quick summary: the first two above just ran; the third ran and displayed a window with the plot. No segfaults on any of them. Then I ran simple_plot.py a fourth time -- using WXAgg. That generated the segfault. Many thanks, Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib-0.87.7 Build Failure
On Thu, 11 Jan 2007, John Hunter wrote: Hmm, what version of wx are you using? wxPython-2.6.3.2-i486-1asz (on Slackware) Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib-0.87.7 Build Failure
From 'python setup.py build': src/_ns_backend_gdk.c:17:25: pygtk/pygtk.h: No such file or directory However, ... [EMAIL PROTECTED] ~]$ locate pygtk.h /usr/local/pygtk-2.8.6/gtk/pygtk.h /usr/local/include/pygtk-2.0/pygtk/pygtk.h Do I need to add /usr/local/include/pygtk-2.0/ somewhere in setup.py? Thanks, Rich -- Richard B. Shepard, Ph.D. |The Environmental Permitting Applied Ecosystem Services, Inc.| Accelerator(TM) http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users