Is there a way to get the current colorbar (or a list of colorbars) for the current axes and update the mappable property? If an update is not possible, i would like to replace the current colorbar with a new one.
I’ve tried something similar to the following:
import pylab as plt
fig = plt.figure()
ax = fig.add_subplot(111)
x = range(10)
y = range(10)
z = range(10)
scatter1 = ax.scatter(x,y,c=z,visible=False)
cbar = fig.colorbar(scatter1)
z = range(10,20)
scatter2 = ax.scatter(x,y,c=range(10,20),visible=True)
cbar.mappable = scatter2
but the colorbar is still on the range 0…9.
Also, is there a way to control the visibility of the colorbar?