Professional Documents
Culture Documents
Import Matplotlib
Import Matplotlib
Import Matplotlib
pyplot as plt
import numpy as np
fig, ax = plt.subplots()
ax.set_xlim([-1, 1])
ax.set_ylim([-1, 1])
ax.set_aspect('equal')
ax.grid(True)
plt.show()
return transformed_vectors
# Vectores en 2D
# Graficar vectores en 2D
plot_vectors_2d(vectors_2d, colors_2d)
[0, 1, 2],
[-1, 0, 1]])
# Vectores en 3D
[0, 1, 0],
[0, 0, 1]])
fig = plt.figure()
ax = fig.add_subplot(121, projection='3d')
ax.set_xlim([0, 1])
ax.set_ylim([0, 1])
ax.set_zlim([0, 1])
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('Vectores en 3D (Original)')
ax.legend()
ax = fig.add_subplot(122, projection='3d')
ax.set_xlim([0, 3])
ax.set_ylim([0, 3])
ax.set_zlim([0, 3])
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title('Vectores en 3D (Transformado)')
ax.legend()
plt.show()