From: Abraham S. <ab...@cn...> - 2005-07-08 02:12:11
|
Hi. I just installed the newest version of matplotlib (0.82), and discovered all my subplots were ending on top of each other. After going through my code and verifying everything looked okay, I tried a simple: subplot(2, 1, 1); plot(range(0, 10)); subplot(2, 2, 2); plot(range(0, 10)) and still only got one subplot. I went to the matplotlib code, and after some prodding, discovered that all the keys for the _seen map were exactly the same. Going to the _make_key function revealed that my use of subplot (i.e. three seperate arguments), was not working. Here is a fix that seems to work for me: (int _make_key function): if iterable(args[0]): key = tuple(args[0]), tuple( fixitems(kwargs.items())) ## NEW elif len(args) > 1: key = args, tuple( fixitems(kwargs.items())) ## \NEW else: key = args[0], tuple(fixitems( kwargs.items())) Abe |
From: Eric F. <ef...@ha...> - 2005-07-08 02:20:10
|
Abe, That bug has been fixed in CVS; like you, I tripped over it in 0.82 and tracked it down--but someone else had already fixed it. A workaround, if you don't want to install from CVS, is to use the old subplot(211) form instead of subplot(2,1,1). Eric Abraham Schneider wrote: > Hi. I just installed the newest version of matplotlib (0.82), and > discovered all my subplots were ending on top of each other. After going > through my code and verifying everything looked okay, I tried a simple: > > subplot(2, 1, 1); plot(range(0, 10)); subplot(2, 2, 2); plot(range(0, 10)) > > and still only got one subplot. I went to the matplotlib code, and after > some prodding, discovered that all the keys for the _seen map were > exactly the same. Going to the _make_key function revealed that my use > of subplot (i.e. three seperate arguments), was not working. Here is a > fix that seems to work for me: > > (int _make_key function): > if iterable(args[0]): > key = tuple(args[0]), tuple( fixitems(kwargs.items())) > ## NEW > elif len(args) > 1: > key = args, tuple( fixitems(kwargs.items())) > ## \NEW > else: > key = args[0], tuple(fixitems( kwargs.items())) > > Abe > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the 'Do More With Dual!' webinar > happening > July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual > core and dual graphics technology at this free one hour event hosted by HP, > AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel |
From: Abraham S. <ab...@cn...> - 2005-07-08 02:36:52
|
That's good to know. I tried googling it, but I guess I should've also checked CVS as well. I'm sure it's better than my hack anyways -- just good to have my scripts working again. I tend to prefer the subplot(w, h, n) since most of my plotting is automated, and it's more of a pain to have to convert the parameters to a string first, etc. A Eric Firing wrote: > Abe, > > That bug has been fixed in CVS; like you, I tripped over it in 0.82 > and tracked it down--but someone else had already fixed it. A > workaround, if you don't want to install from CVS, is to use the old > subplot(211) form instead of subplot(2,1,1). > > Eric > > Abraham Schneider wrote: > >> Hi. I just installed the newest version of matplotlib (0.82), and >> discovered all my subplots were ending on top of each other. After >> going through my code and verifying everything looked okay, I tried a >> simple: >> >> subplot(2, 1, 1); plot(range(0, 10)); subplot(2, 2, 2); plot(range(0, >> 10)) >> >> and still only got one subplot. I went to the matplotlib code, and >> after some prodding, discovered that all the keys for the _seen map >> were exactly the same. Going to the _make_key function revealed that >> my use of subplot (i.e. three seperate arguments), was not working. >> Here is a fix that seems to work for me: >> >> (int _make_key function): >> if iterable(args[0]): >> key = tuple(args[0]), tuple( fixitems(kwargs.items())) >> ## NEW >> elif len(args) > 1: >> key = args, tuple( fixitems(kwargs.items())) >> ## \NEW >> else: >> key = args[0], tuple(fixitems( kwargs.items())) >> >> Abe >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by the 'Do More With Dual!' webinar >> happening >> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual >> core and dual graphics technology at this free one hour event hosted >> by HP, >> AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the 'Do More With Dual!' webinar > happening > July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual > core and dual graphics technology at this free one hour event hosted > by HP, > AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel |