Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contour_surf contours argument is broken #29

Closed
adamreeve opened this issue May 10, 2012 · 3 comments
Closed

contour_surf contours argument is broken #29

adamreeve opened this issue May 10, 2012 · 3 comments

Comments

@adamreeve
Copy link
Contributor

The documentation for the contours argument to mlab.contour_surf says, "Specifying 0 shows no contours," but specifying 0 actually gives an error:

AssertionError: The contours argument must be positive

I also have many other problems with this argument but I've only been able to test them on 3.3, so I'm not sure if they still apply:

  • Passing a list to the contours parameter seems to have no effect, the resulting contours are the same no matter what I put in the list.
  • Passing an integer as the contours parameter actually gives me two less than that number of contour levels. So I have to pass 3 to get one set of contour lines.
@adamreeve
Copy link
Contributor Author

Looks like the number of contours is correct, it's just that there are two contours at the very maximum and minimum that don't actually show up.

@adamreeve
Copy link
Contributor Author

Small test example, I'd expect contours at 0.0 and 1.0, but instead I get 8 contours. This is tested on the latest git master (16305d9).

import numpy
from mayavi.mlab import *

def f(x, y):
    sin, cos = numpy.sin, numpy.cos
    return sin(x+y) + sin(2*x - y) + cos(3*x+4*y)

x, y = numpy.mgrid[-7.:7.05:0.1, -5.:5.05:0.05]

fig = figure(bgcolor=(1.0, 1.0, 1.0), fgcolor=(0.2, 0.2, 0.2))
s = contour_surf(x, y, f, contours=[0.0, 1.0])
s.contour.contours = [0.0, 1.0]
a = axes()
show()

@adamreeve
Copy link
Contributor Author

Marking as fixed as pull request #30 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant