I have 2 variables (x,y) that change with time (t). I want to plot x vs. t and color the ticks based on the value of y. e.g. for highest values of y the tick color is dark green, for lowest value is dark red, and for intermediate values the color will be scaled in between green and red.
Can this be done with matplotlib in python?
This is what
matplotlib.pyplot.scatteris for.If no colormap is specified,
scatterwill use whatever the default colormap is set to. To specify which colormap scatter should use, use thecmapkwarg (e.g.cmap="jet").As a quick example:
One may specify a custom color map and norm