X Tutup
Skip to content

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

@galaunay

Description

@galaunay

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup