Allow color to also be an iterable
Currently, color has to be Optional[str]. I request that an iterable also be allowed for it, with the same length as x and y. This is intended to conveniently allow piecewise coloring. For example, I may want to sometimes specify color=['green', 'green', 'red', 'yellow'], etc.
Interesting idea. I don't think I've ever had to make each point in a plot a different color (without also needing labels for each, at which point you need to make each point a separate plotting call anyway). What's your use case?
This is not my actual use case, but it's a simplified one: I am plotting the hourly weather temperature. If it's getting hotter, I want to use red. If it's getting colder, I want to use blue.
For now I would be okay with the label functionality remaining unchanged as Optional[str], applicable to the entire sequence.
Another use case is: I am plotting the hourly weather temperature. If however it's getting more humid, I use red. If it's getting less humid, I use green. If the humidity is the same, I use yellow. To restate, I am however plotting the temperature values.
That sounds pretty unique. If more people express interest in such a convenience feature, I will look into it. For now, you should be able to make what you want by plotting each color as a separate call with something like this:
temperature = np.array([16, 17, 18, 16, 15, 18, 21, 19])
going_up_indices = [0,1,2,5,6]
going_down_indices = [3,4,7]
fig = tplot.Figure()
fig.scatter(x=going_up_indices, y=temperature[going_up_indices], color="red")
fig.scatter(x=going_down_indices, y=temperature[going_down_indices], color="blue")
fig.show()
Doing it for a line plot is similar: define the color for each line segment (two subsequent temperature values) and plot each segment separately in a for loop.