how to make colored candles?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how to make colored candles?

taru
Hi !

https://github.com/enthought/chaco/blob/master/examples/demo/basic/candle.py

Can I make a candle (candle body) colored?
Now the candle body is one color.

For example....

open = low + delta * random.uniform(0.05, 0.95, size=numpoints)
close = low + delta * random.uniform(0.05, 0.95, size=numpoints)
+>> colz = ["red","black","green",0.28,0.33 ........................]
->> sorted_vals = vstack((open, high, low, close, average))
+>> sorted_vals = vstack((open, high, low, close, average,colz))
sorted_vals.sort(0)

    pd = ArrayPlotData(index = index,
                       min = sorted_vals[0],
                       bar_min = sorted_vals[1],
                       average = sorted_vals[2],
                       bar_max = sorted_vals[3],
                       max = sorted_vals[4],
   +>> body_color = sorted_vals[5])

    # Create the plot
    plot = Plot(pd)
    plot.candle_plot(("index", "min", "bar_min", "average", "bar_max",
"max",+>>"body_color"),
                     color = "lightgray",
                     bar_line_color = "black",
                     stem_color = "blue",
                     center_color = "red",
                     center_width = 2)

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev