<blockquote>
<p>it is not clear why you would want to avoid <code>FuncAnimation</code>.</p>
</blockquote>
<p>For very simple tests, where you want to check a situation deep inside a loop, it is not easy to set up an <code>animation</code> function.</p>
<p>For instance, I wanted to visualize what happens with this strange sort algorithm: <a href="https://arxiv.org/pdf/2110.01111.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/2110.01111.pdf</a>. To my opinion, the simplest way to do it is:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt

def sort(table):
    n = len(table)
    
    for i in range (n):
        for j in range (n):
            if table[i] &lt; table[j]:
                tmp = table[i]
                table[i] = table[j]
                table[j] = tmp
            plt.plot(table, 'ro')
            plt.title(f&quot;i {i} j {j}&quot;)
            plt.pause(0.001)
            plt.clf() # clear figure
    return table

n = 50
table =  np.random.randint(1,101,n)
sort(table)
```python

</code></pre>
Animating with matplotlib without animation function
<p>Is there a way to animate a graph in matplotlib without resorting to the built in animation functions? I find them extremely awkward to use and feel it would be much simpler to just plot a point, wipe the graph, then plot the next point. </p>

<p>I envision something such as:</p>

<pre><code>def f():
     # do stuff here
     return x, y, t
</code></pre>

<p>where each <code>t</code> would be a different frame. </p>

<p>I mean, I've tried stuff like using <code>plt.clf()</code>, <code>plt.close()</code> etc. but nothing seems to work. </p>