You can assign a colormap to a scatter plot by using scatter(X, Y, c=..., cmap="rainbow")
for example, but is there a way to modify the colormap later?
I know we can change the transparency and color via set_color()
and set_alpha()
but I did not find the equivalent for colormaps. A workaround would be to save the data of the scatter, erase it, then scatter()
again with new parameters but that is going to be expensive. That is an issue since the goal of this question is to be able to change the c
parameter in real time so that old points "cool down" to darker colors.
Thanks for your time.
Edit to add more information: I would like to be able to switch back and forth between a scatter made with a single color and a scatter with a variable colormap and normalization. Between scatter(X, Y, color="#FF0000")
and scatter(X, Y, c=age, cmap="rainbow")
for example, with a variable age = [i for i,x in enumerate(X)]
.