Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion Graph.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
import matplotlib.pyplot as plt
import numpy as np

class Graph:

#Init creates empty graph
def __init__(self):
self.fig, self.ax = plt.subplots() #Init the figure and init a subplot in figure
self.fig, self.ax = plt.subplots()
print("Graph initiated")

#Creates a connection to the graph
def connect_to_graph(self,typeEvent,typeUserInput):
self.fig.canvas.mpl_connect(typeEvent,typeUserInput)

#Creates a new plot taking event data on graph
def draw_new_store(self,event):
self.ax.plot(event.xdata, event.ydata, 'o')

#Creates centroids
def draw_new_centroids(self,centroid1,centroid2):
centroid_one = self.ax.plot(centroid1[0], centroid1[1], 'X')
centroid_two = self.ax.plot(centroid2[0], centroid2[1], 'X')

#Updates graph
def updateGraph(self):
plt.show()