Plot a line from [x1, y1] to [x2, y2]
See original GitHub issueHey, this library is great and super easy to use. Thanks for writing it!
I’m now trying to draw a line between two coordinates but can’t seem to get it working. Any recommendations how I can do this easily? Happy to send a PR if it comes to that.
I’ve tried a few things but none of them are satisfactory. Ideally, the interface would be similar to add_band(), it could be something like add_line(ax, [x1, y1], [x2, y2], width, color).
Here is what I’ve tried so far:
Added the code below to the example in the README but this only works if I comment out the calls to fplt.PandasDataSource and candlestick_ochl. If I don’t comment these lines, then the code below does not work.
line = fplt.pg.LineSegmentROI([[0,0], [1100, 200]], pen=(255,9,0), movable=False) line.setZValue(60) ax2.addItem(line)
Also tried fplt.addline
and fplt.pg.LineROI
but they show the same behavior as above.
How do I draw a line between two coordinates? Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Hi Naman,
Sorry for the late reply. I just added the feature you requested, fetch it by pip install -U finplot. I also included an example: https://github.com/highfestiva/finplot/blob/master/finplot/example-line.py. Good luck!
/Jonas
------ Originalmeddelande ------ Från: “Naman Kumar” notifications@github.com Till: “highfestiva/finplot” finplot@noreply.github.com Kopia: “Subscribed” subscribed@noreply.github.com Skickat: 2019-06-26 08:18:22 Ämne: [highfestiva/finplot] Plot a line from [x1, y1] to [x2, y2] (#2)
Works great, cheers!