I'm trying to build a solution to a linear system with 3 planes, the solution is a point (1,1,1) I drew a point using the point command, but I suspect that the point is not in the right place:
ax.plot([1.], [1.], [1.], markerfacecolor='k', markeredgecolor='k', marker='o', markersize=5, alpha=0.6)
Thanks So, the code:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sympy.solvers import *
from sympy import *
from matplotlib import rcParams
rcParams['text.latex.unicode'] = True
rcParams['text.usetex'] = True
rcParams['text.latex.preamble'] = '\\usepackage{amsthm}', '\\usepackage{amsmath}', '\\usepackage{amssymb}',
'\\usepackage{amsfonts}', '\\usepackage[T1]{fontenc}', '\\usepackage[utf8]{inputenc}'
f1 = lambda x, y: x + y -1
f2 = lambda x, y: 1 - x + y
f3 = lambda x, y: 1 + x - y
x = Symbol('x')
y = Symbol('y')
z = Symbol('z')
fun1 = x+y-z-1
fun2 = x-y+z-1
fun3 = -x+y+z-1
solucion = solve([fun1, fun2, fun3], [x, y, z])
pprint(('Solución Del Sistema es: {}').format(solucion))
x1 = y1 = np.arange(-5, 5, 0.25)
ceros = np.zeros(len(x1))
x, y = np.meshgrid(x1, y1)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(x, y, f1(x, y), rstride=1, cstride=1, linewidth=0, antialiased=True, color='blue')
ax.plot_surface(x, y, f2(x, y), rstride=1, cstride=1, linewidth=0, antialiased=True, color='red')
ax.plot_surface(x, y, f3(x, y), rstride=1, cstride=1, linewidth=0, antialiased=True, color='green')
ax.plot([1.], [1.], [1.], markerfacecolor='k', markeredgecolor='k', marker='o', markersize=5, alpha=0.6)
ax.set_xlim(-10, 10)
ax.set_ylim(-10, 10)
ax.set_zlim(-10, 10)
ax.set_xlabel('x', color='blue')
ax.set_ylabel('y', color='blue')
ax.set_zlabel('z', color='blue')
ax.set_title(r'$Graphical\; Resolution\; Linear\; System\; 3 \times 3$', fontsize=18)
blue_proxy = plt.Rectangle((0, 0), 1, 1, fc='b')
red_proxy = plt.Rectangle((0, 0), 1, 1, fc='r')
green_proxy = plt.Rectangle((0, 0), 1, 1, fc='g')
black_proxy = plt.Line2D([0], [0], linestyle="none", marker='o', alpha=0.6, markersize=10, markerfacecolor='black')
ax.legend([blue_proxy,red_proxy, green_proxy, black_proxy], [r'$x+y-z=1$',r'$x-y+z=1$', r'$-x+y+z=1$', r'$Sol.\; (1,1,1)$'], numpoints=1, loc='upper left')
plt.show()
Picture:
The z-coordinate of point (1,1,1) is not at a height of 1, it is less than zero. Thus, the dot is not drawn in the right place.
