question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plot a line from [x1, y1] to [x2, y2]

See original GitHub issue

Hey, 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
highfestivacommented, Jul 6, 2019

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)

Hey, 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 works fine but it’s useless because the stock price is not there!

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!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/highfestiva/finplot/issues/2?email_source=notifications&email_token=AABHEL6DGAWHAY6IYFN4PATP4MC25A5CNFSM4H3O2TP2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G3W7AGA, or mute the thread https://github.com/notifications/unsubscribe-auth/AABHEL5L2LII5ITM7DPTYQ3P4MC25ANCNFSM4H3O2TPQ.

0reactions
namankumarcommented, Jul 15, 2019

Works great, cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wolfram|Alpha Widgets: "Plot line of (x1,y1),(x2,y2)"
Will calculate X & Y intercepts, distance ; between the points, and midpoint. ; x1 ; x2 ; y1.
Read more >
Plotting two point (x1,y1) and (x2,y2) which stored in a matrix ...
Hi, meaning use plot(x,y, type="l") for first point then second point and connecting them with line then add NA and restart plot? –...
Read more >
How can I draw a line with two points x1, y1 and x2, y2 and ...
How can I draw a line with two points (x1, y1) and (x2, y2) and assign weight to the edge. Thanks in advance....
Read more >
Coordinates 16: Line passing through (x1,y1) and (x2,y2)
Coordinates. Coordinates 16: Line passing through ( x1, y1 ) and ( x2, y2 ). 2K views 8 years ago. AUT literacy for...
Read more >
function for plotting a line between any two points (x1,y1) and ...
From: Arvind Raman ; Subject: function for plotting a line between any two points (x1,y1) and (x2,y2) ; and (x2,y2). Date: Mon, 18...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found