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

In 'pyplot.streamplot', starting points near the same streamline raise 'InvalidIndexError' #6003

Closed
galaunay opened this issue Feb 14, 2016 · 1 comment
Milestone

Comments

@galaunay
Copy link

Choosing two starting points in the same streamline in pyplot.streamplot lead to
an InvalidIndexError.

Minimal non-working example :

import numpy as np
import matplotlib.pyplot as plt

# Data
x = np.linspace(-10, 10, 10)
y = np.linspace(-10, 10, 10)
X, Y = np.meshgrid(x, y)
U = X*0 + 1
V = X*0
start_points = np.array([[0, 0], [5, 0]])

# streamline plot with aligned starting points
plt.figure()
sp = plt.streamplot(x, y, U, V, start_points=start_points,
                    color='r')
plt.show()

Maybe a better behaviour would be to skip the points responsible for the conflicts, i.e replacing in streamplot.py (in get_integrator(), integrate()):
dmap.start_trajectory(x0, y0)
by

try:
    dmap.start_trajectory(x0, y0)
except InvalidIndexError:
    return None
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Feb 15, 2016
@tacaswell
Copy link
Member

That on the surfaces seems reasonable to me. Can you open a pull request with that change?

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

2 participants