Skip to content

[Bug]: Startpoints in streamplot fail on right and upper edges #21649

Closed
@IlyaOrson

Description

@IlyaOrson

Bug summary

Using starting points in a streamplot does not work if they are in the bottom or right edges.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

x,y = np.linspace(-3,3,100),np.linspace(-3,3,100)
X,Y = np.meshgrid(x,y)
U = -1 - X**2 + Y
V = 1 + X - Y**2
speed = np.sqrt(U*U + V*V)

start = [[0,0], [1,2]]

fig0, ax0 = plt.subplots()

strm = ax0.streamplot(x,y, U, V, color=(.75,.90,.93))

# note: moving away from the edge is a workaround
#bump = 50*np.finfo(float).eps
bump = 0
rightside_points = [[i,3-bump] for i in np.linspace(-3,3,5)]
bottomside_points = [[3-bump,i] for i in np.linspace(-3,3,5)]

rightside_mat = np.vstack(rightside_points)
bottomside_mat = np.vstack(bottomside_points)

# start points on right side do not work
ax0.streamplot(x,y, U, V, start_points=rightside_points, color="crimson", linewidth=2)
ax0.plot(rightside_mat[:,0], rightside_mat[:,1], "gx", markersize=12, label="upper")

# start points on bottom side do not work
ax0.streamplot(x,y, U, V, start_points=bottomside_points, color="crimson", linewidth=2)
ax0.plot(bottomside_mat[:,0], bottomside_mat[:,1], "mx", markersize=12, label="right")

plt.legend()
plt.show()

Actual outcome

does_not_work

Expected outcome

I we take points on the left and bottom edge it works as expected.
almostworks

Additional information

If we move just a bit away from the problematic edges everything works as expected.

Operating system

Windows

Matplotlib Version

3.4.2

Matplotlib Backend

No response

Python version

3.8.3

Jupyter version

No response

Installation

Miniconda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions