Change RGB color in matplotlib animation
<p>I seems that it is not possible to change colors of a Matplotlib scatter plot through a RGB definition. Am I wrong?</p>

<p>Here is a code (already given in stack overflow) which work with colors indexed in float:</p>

<pre><code>import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation

def main():
    numframes = 100
    numpoints = 10

    color_data = np.random.random((numframes, numpoints))
    x, y, c = np.random.random((3, numpoints))

    fig = plt.figure()
    scat = plt.scatter(x, y, c=c, s=100)

    ani = animation.FuncAnimation(fig, update_plot, frames=range(numframes),
                                  fargs=(color_data, scat))
    plt.show()

def update_plot(i, data, scat):
    scat.set_array(data[i])
    return scat,

main()
</code></pre>

<p>But if <code>color_data</code> is defined through RGB colors, I get an error: </p>

<blockquote>
  <p>ValueError: Collections can only map rank 1 arrays</p>
</blockquote>

<p>The related code is the following (in this code, I just change the color of one sample each time):</p>

<pre><code>import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation

def main():
    numframes = 100
    numpoints = 10

    rgb_color_data = np.random.random((numpoints, 3))
    x, y = np.random.random((2, numpoints))

    fig = plt.figure()
    scat = plt.scatter(x, y, c=rgb_color_data, s=100) #this work well at this level

    ani = animation.FuncAnimation(fig, update_plot2, frames=range(numframes),
                                  fargs=(rgb_color_data, scat))

    plt.show()

def update_plot2(i,data,scat):
    data[ i%10 ] = np.random.random((3))
    scat.set_array(data) # this fails 
    return scat,

main()
</code></pre>

<p>Is there a means to use <code>set_array</code> with RGB color array?</p>