1

I am trying to show the points of intersection on the graph but the problem is that the shape of my data is different when i am ploting them simple i get the results

this is my code of graph

plt.plot(x,color='green')
plt.plot(y, color='blue')
plt.plot(z, color='orange')
plt.legend()
plt.show()

Results of graph

But when i am trying to find the point of intersection i am getting error

unsupported operand type(s) for -: 'list' and 'list'

on this line

idx = np.argwhere(np.diff(np.sign(y - x))).flatten()

this is my code to find the point of intersection which is not working

import numpy as np
import matplotlib.pyplot as plt

x=test1.history['acc']
y=test2,.history['acc']
z=test3.history['acc']

plt.plot(x, y, '-')
plt.plot(x, z, '-')

idx = np.argwhere(np.diff(np.sign(y - x))).flatten()
plt.plot(x[idx], y[idx],z[idx], 'ro')
plt.show()

I am getting the result but it is not valid it is showing the results like this

enter image description here

Tayyab Vohra
  • 1,512
  • 3
  • 22
  • 49
  • Can you please compare that question is same with that one? – Tayyab Vohra Jun 19 '19 at 13:49
  • Maybe [this post](https://stackoverflow.com/questions/20677795/how-do-i-compute-the-intersection-point-of-two-lines-in-python) can help you to find intersection between two lines ? – Alexandre B. Jun 19 '19 at 13:53
  • after finding the pont of intersection how i would be able to plot them in my graph can you make an answer with that @AlexandreB. – Tayyab Vohra Jun 19 '19 at 13:56

0 Answers0