Update marker sizes of a scatter plot

matplotlib, python, scatter-plot

Solution

Yes it is doable, with using a magic method (`_size`). Use it with caution, as it may become broken in future releases:

from matplotlib import pyplot as plt
import numpy as np

x, y=range(10), range(10)
sca=plt.scatter(x,y)
raw_input()
sca._sizes=(5+np.arange(10))*10 #you can set you markers to different sizes
plt.draw()

Problem

A scatter plot object has a method called `.set_array` to update the colours of the markers and `.set_offsets` to update their position but how can I update the marker sizes? I need this for fast real time plotting.

Original source