I am trying to understand a problem-set which involves cartesian planes where:
f(x, y) = min(x, y)
g(x, y) = max(x, y)
h(x, y) = x + y
For this reason I was trying to plot the given functions using python and matplotlib like this:
data_x_axis = list(range(11))
data_y_axis = list(range(11))
data_z_axis = []
for x_value in data_x_axis:
data_z_axis.append([min(x_value, y_value) for y_value in data_y_axis])
print(data_z_axis)
%matplotlib notebook
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Grab some test data.
X = data_x_axis
Y = data_y_axis
Z = np.array(data_z_axis)
# Plot a basic wireframe.
ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)
plt.show()
In essence this is the example code from: https://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#wireframe-plots
x,y values ranging from 0 to 10, z being computet as min(x,y).
However the result was this:
My math is beyond rusty, but I was expecting a surface area, not a two dimensional triangle.
Is my understanding of the underlying math wrong or did I make a mistake in computing the values/plotting them in matplotlib?