0
votes

I have made a candlestick currency chart on python using matplotlib.finance. Everything is working but I would like to add lines and shapes on the actual chart. When I was using normal type of chart in matplotlib. I would be doing:

plt.plot([xmin, xmax], [0.0005,0.0005], linewidth=3, color='purple')

To draw a horizontal line from xmin to xmax (to be defined) at the 0.0005 price level.But since I am using the method candlestick2_ohlc I don't really know how to proceed...

This is what I have:enter image description here

This is what I am looking to get:enter image description here

Also is it possible to draw and fill triangles?

2

2 Answers

1
votes

Drawing segments

plt.plot([xmin, xmax], [ymin, ymax])

Drawing triangles

x = [x1, x2]
y = [y1, y2]
plt.fill(x,y)

Drawing polygons

x = [x1,...,xn]
y = [y1,...,yn]
plt.fill(x,y)

It's that easy!

enter image description here

0
votes

The easiest way to draw a horizontal line is to use

plt.axhline(y=1.066)