Plotting Only One Point in 3D Matplotlib -


i'm trying plot solution of linear system 3 planes, solution point (1,1,1) i've plotted point point command suspect point not in right place:

ax.plot([1.], [1.], [1.], markerfacecolor='k', markeredgecolor='k', marker='o', markersize=5, alpha=0.6) 

thanks ok, code is:

#/usr/bin/env python3 # -*- coding: utf-8 -*-   import numpy np import matplotlib.pyplot plt mpl_toolkits.mplot3d import axes3d sympy.solvers import * sympy import * matplotlib import rcparams   # activating latex 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}'   # declaring 3 planes functions f1 = lambda x, y: x + y -1 f2 = lambda x, y: 1 - x + y f3 = lambda x, y: 1 + x - y  # declaring symbolic variables x = symbol('x') y = symbol('y') z = symbol('z')  # solving linear system fun1 = x+y-z-1 fun2 = x-y+z-1 fun3 = -x+y+z-1 solucion = solve([fun1, fun2, fun3], [x, y, z])  # printing solution pprint(('solución del sistema es: {}').format(solucion))   # stablishing our ranges our variables x1 = y1 = np.arange(-5, 5, 0.25) ceros = np.zeros(len(x1))  # stablishing our meshgrid x, y = np.meshgrid(x1, y1)  # our 3d canvas figure plot fig = plt.figure() ax = fig.add_subplot(111, projection='3d')  # plotting 3 planes 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)  # putting limits in axes ax.set_xlim(-10, 10) ax.set_ylim(-10, 10) ax.set_zlim(-10, 10)  # writing axis labels ax.set_xlabel('x', color='blue') ax.set_ylabel('y', color='blue') ax.set_zlabel('z', color='blue')  # writing title of plot ax.set_title(r'$graphical\; resolution\; linear\; system\; 3 \times 3$', fontsize=18)  # stablishing plots of our legend labels 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')  # drawing our legend 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() 

an image:

the z-coordinate of point (1,1,1) not @ height 1, below 0. so, point not drawn in correct place. image of code

i think code correct. point @ position namely (1,1,1). can drag plot see point angle , you'll find point @ correct position.

trust yourself! replacing z-coordinate of point maybe 10.0, you'll find code correct.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -