enthought / enthought/mayavi

Plotting many lines throws errors if x/y/z data is reduced in size

Open
#772 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

Similar to https://github.com/enthought/mayavi/issues/770

I took this: http://docs.enthought.com/mayavi/mayavi/auto/example_plotting_many_lines.html

And modify the x/y/z points data to reduce the number of points, leaving mlab_source.dataset.lines alone. If the previous .lines overindexes the new points array, a bunch of errors show up in the vtkWindowError.

Setting .lines to None before updating the x/y/z/scalar data prevents the errors.

Either mayavi should silently set `pd.lines=None` for you, or probably better would be to detect when x/y/z/scalar data is reducing in size, and if there's existing .lines data, warn the user that they need to clear/reset lines around the x/y/z update call, and set .lines to None to avoid the vtk errors.

Or at a minimum, add an example of this to the example linked above.

Similar to referenced bug, run `python2 bug_lines.py [errors|skip|workaround]` to illustrate.
Test case attached here: [lines.zip](https://github.com/enthought/mayavi/files/3122989/lines.zip)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.