Missing or broken examples

I've been relying very heavily on the examples lately to test my refactored branch of matplotlib. In doing so, I've discovered a few that are currently broken in matplotlib's trunk. I'm reporting these just to bring them to the attention of the list, not because they are priority bugs for me. Some of these may simply be old and should be removed. Let me know if you need any more information for them.

I've also run backend_driver.py through a code coverage tool (coverage.py) and identified a few large parts of the code that weren't covered. I added a dozen or so existing examples to backend_driver, and now though there are lots of little places that never get run (mainly error cases and such), the code coverage of backend_driver is quite good. The only high-level method in axes.py that isn't being tested is cohere(). Does anyone have a test for it that could be added?

Errors follow.

Cheers,
Mike

> python agg_resize.py
Traceback (most recent call last):
   File "agg_resize.py", line 7, in <module>
     interp = agg.span_interpolator_linear(imMatrix);
AttributeError: 'module' object has no attribute 'span_interpolator_linear'

> python embedding_in_wx2.py
[The y-axis labels are being cut off at the bottom of the figure.]

> python image_slices_viewer.py
[It says the "use the scroll wheen to navigate images" [sic], but the scroll wheel doesn't appear to do anything in TkAgg on Linux.]

> python keypress_demo.py
[Pressing "g" to toggle the grid causes the grid to flash momentarily and then disappear again.]

> python bar_unit_demo.py
Traceback (most recent call last):
   File "bar_unit_demo.py", line 14, in <module>
     p1 = ax.bar(ind, menMeans, width, color='r', bottom=0*cm, yerr=menStd)
   File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 3307, in bar
     fmt=None, ecolor=ecolor, capsize=capsize)
   File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 3727, in errorbar
     lower = y-yerr
TypeError: unsupported operand type(s) for -: 'int' and 'TaggedValue'

> python ellipse_with_units.py
Traceback (most recent call last):
   File "ellipse_with_units.py", line 36, in <module>
     ax.add_patch(e1)
   File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1143, in add_patch
     self._update_patch_limits(p)
   File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1150, in _update_patch_limits
     p.get_transform(), p.get_verts())
   File "/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/patches.py", line 814, in get_verts
     x = width/2. * npy.cos(theta)
TypeError: unsupported operand type(s) for /: 'TaggedValue' and 'float'

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

I've been relying very heavily on the examples lately to test my
refactored branch of matplotlib. In doing so, I've discovered a few
that are currently broken in matplotlib's trunk. I'm reporting these
just to bring them to the attention of the list, not because they are
priority bugs for me. Some of these may simply be old and should be
removed. Let me know if you need any more information for them.

I've also run backend_driver.py through a code coverage tool
(coverage.py) and identified a few large parts of the code that weren't
covered. I added a dozen or so existing examples to backend_driver, and
now though there are lots of little places that never get run (mainly
error cases and such), the code coverage of backend_driver is quite
good. The only high-level method in axes.py that isn't being tested is
cohere(). Does anyone have a test for it that could be added?

This is great -- our backend _driver is a poor man's unit test, but it
has served us well and it's good to make the most of it. I've added a
cohere_demo.py and added it to backend_driver.

> python agg_resize.py
Traceback (most recent call last):
   File "agg_resize.py", line 7, in <module>
     interp = agg.span_interpolator_linear(imMatrix);
AttributeError: 'module' object has no attribute 'span_interpolator_linear'

Hmm, for some reason the following lines are commented out of swig.agg.i

//%include "agg_span_interpolator_linear.h"
//%template(span_interpolator_linear_affine)
agg::span_interpolator_linear<agg::trans_affine>;
//%include "agg_span_image_filter.i"

I think I am the only one who has worked on this part of the code, so
I must have done it but don't know why. This is a low priority bug
since we are not using the low level agg renderer for much (it was
written to try and decrease reliance and ultimately drop the CXX) but
the endeavor has languished. I'll need to spend some time to figure
out why this is commented out and if it can be restored.

> python embedding_in_wx2.py
[The y-axis labels are being cut off at the bottom of the figure.]

This is a pretty low priority since I am already somewhat inclined to
drop pure wx rendering.

> python image_slices_viewer.py
[It says the "use the scroll wheen to navigate images" [sic], but the
scroll wheel doesn't appear to do anything in TkAgg on Linux.]

This works in gtkagg -- some tk users/developer/advocate needs to add
support for the 'scroll_event'. I consider this to be fairly high
priority and an easy fix.

> python keypress_demo.py
[Pressing "g" to toggle the grid causes the grid to flash momentarily
and then disappear again.]

Fixed - this was written a long time ago before toggling the grid with
'g' was made the default. So this example simply toggled it on and
off since two event handlers were being triggered. I rewrote it to to
toggle the xlabel

> python bar_unit_demo.py
Traceback (most recent call last):
   File "bar_unit_demo.py", line 14, in <module>
     p1 = ax.bar(ind, menMeans, width, color='r', bottom=0*cm, yerr=menStd)
   File
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line
3307, in bar
     fmt=None, ecolor=ecolor, capsize=capsize)
   File
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line
3727, in errorbar
     lower = y-yerr
TypeError: unsupported operand type(s) for -: 'int' and 'TaggedValue'

fixed in svn

> python ellipse_with_units.py
Traceback (most recent call last):
   File "ellipse_with_units.py", line 36, in <module>
     ax.add_patch(e1)
   File
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line
1143, in add_patch
     self._update_patch_limits(p)
   File
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/axes.py", line
1150, in _update_patch_limits
     p.get_transform(), p.get_verts())
   File
"/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/patches.py",
line 814, in get_verts
     x = width/2. * npy.cos(theta)
TypeError: unsupported operand type(s) for /: 'TaggedValue' and 'float'

fixed in svn

JDH

···

On 10/29/07, Michael Droettboom <mdroe@...31...> wrote:

Once we get these bugs cleared up, and the tkagg segfault I mentioned
earlier, it is probably a good time to prepare for a new release.
There have been lots of major enhancements in the trunk since 0.90.1,
most importantly the new mathtext. I encourage everyone to visit the
bugs and patches page and let's knock out as many as we can and get
any new features from developers trees in, and shoot for a release
next week.

After that, are you getting close Michael to merging your branch into
the trunk?

JDH

···

On 10/29/07, Michael Droettboom <mdroe@...31...> wrote:

I've also run backend_driver.py through a code coverage tool
(coverage.py) and identified a few large parts of the code that weren't
covered. I added a dozen or so existing examples to backend_driver, and
now though there are lots of little places that never get run (mainly
error cases and such), the code coverage of backend_driver is quite
good. The only high-level method in axes.py that isn't being tested is
cohere(). Does anyone have a test for it that could be added?

John Hunter wrote:

After that, are you getting close Michael to merging your branch into
the trunk?

I think our lines crossed -- I just sent an e-mail about this.

This is probably implied, but I think it would be a good idea to keep a maintenance branch around based on the upcoming release -- it may be helpful to be able to make quick and easy bugfixes against the release without worrying about all the new bugs my branch has introduced :wink:

I've been merging trunk into my branch almost daily since I started, so the merge back into the trunk should be reasonably painless.

Cheers,
Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA