I have a time series of data for which I have the quantity, y, and its error, yerr. I would now like to create a plot that shows y against phase (i.e. time / period % 1) wit
I was looking for the solution for a while and I finally found a way through:
from pylab import *
#data
time = arange(100.)
signal = time**2
error = ones(len(time))*1000
figure(1)
#create a scatter plot
sc = scatter(time,signal,s=20,c=time)
#create colorbar according to the scatter plot
clb = colorbar(sc)
#create errorbar plot and return the outputs to a,b,c
a,b,c = errorbar(time,signal,yerr=error,marker='',ls='',zorder=0)
#convert time to a color tuple using the colormap used for scatter
time_color = clb.to_rgba(time)
#adjust the color of c[0], which is a LineCollection, to the colormap
c[0].set_color(time_color)
fig = gcf()
fig.show()
xlabel('time')
ylabel('signal')