TroglodyteDerivations
commited on
Commit
•
1b66d7e
1
Parent(s):
865df20
Updated the Object behavior / Method plot_vector_add
Browse files
app.py
CHANGED
@@ -21,14 +21,14 @@ class Vector_Addition:
|
|
21 |
def plot_vector_add(self):
|
22 |
plt.figure(figsize=(10,5))
|
23 |
plt.plot([0, self.v1[0]], [0, self.v1[1]], 'b', label='v1')
|
24 |
-
plt.plot([0, self.v2[0]], [0, self.v2[1]], 'r', label='v2')
|
25 |
plt.plot([0, self.v1[0]+ self.v2[0]], [0, self.v1[1]+ self.v2[1]], 'k', label='v1+v2')
|
26 |
plt.xlabel('X')
|
27 |
plt.ylabel('Y')
|
28 |
plt.title('Vector Addition')
|
29 |
plt.grid(True)
|
30 |
plt.legend()
|
31 |
-
|
32 |
buf = BytesIO()
|
33 |
plt.savefig(buf, format='png')
|
34 |
buf.seek(0)
|
|
|
21 |
def plot_vector_add(self):
|
22 |
plt.figure(figsize=(10,5))
|
23 |
plt.plot([0, self.v1[0]], [0, self.v1[1]], 'b', label='v1')
|
24 |
+
plt.plot([0, self.v2[0]+self.v1[0]], [0, self.v2[1]+self.v1[1]], 'r', label='v2')
|
25 |
plt.plot([0, self.v1[0]+ self.v2[0]], [0, self.v1[1]+ self.v2[1]], 'k', label='v1+v2')
|
26 |
plt.xlabel('X')
|
27 |
plt.ylabel('Y')
|
28 |
plt.title('Vector Addition')
|
29 |
plt.grid(True)
|
30 |
plt.legend()
|
31 |
+
|
32 |
buf = BytesIO()
|
33 |
plt.savefig(buf, format='png')
|
34 |
buf.seek(0)
|