How can I remove a streamplot from a Matplotlib plot without clearing everything (i.e. not using plt.cla() or plt.clf())?
plt.streamplot() returns a StreamplotSet (streams in the following example), which contains the stream lines (.lines) and arrow heads (.arrows).
Calling streams.lines.remove() removes the streamlines as expected.
However, I couldn’t find a way to remove the arrow heads: stream.arrows.remove() raises a NotImplementedError, and stream.arrows.set_visible(False) has no effect.
import matplotlib.pyplot as plt
import numpy as np
# Generate streamplot data
x = np.linspace(-5, 5, 10)
y = np.linspace(-5, 5, 10)
u, v = np.meshgrid(x, y)
# Create streamplot
streams = plt.streamplot(x, y, u, v)
# Remove streamplot
streams.lines.remove() # Removes the stream lines
streams.arrows.set_visible(False) # Does nothing
streams.arrows.remove() # Raises NotImplementedError
The following figure illustrates the example. Left: streamplot, right: remaining arrow heads.
For context, I’m trying to add streamlines to an existing imshow animation (built with matplotlib.animation.FuncAnimation).
In this setup, only the image data are updated at each frame, and I can’t clear and redraw the full plot.

