title: Python - Triming a Surface in 3D plot
body: <p>This question was edited from the original for more clarity.</p>
  <p>I have a python code to plot two surfaces. However, they overlap each other in line where I would like to &quot;trim&quot; those surfaces so I could get a perfect edge at their intersection. My code so far is:</p>
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  from matplotlib import cm
  import time
  import pdb
  start_time = time.time()
  
  fig = plt.figure(figsize=(8,4))
  ax = fig.add_subplot(projection='3d')
  ax.set_xlabel('x')
  ax.set_ylabel('y')
  ax.set_zlabel('z')    
  
  x = np.linspace(-2.5,3.104,1000)
  y = np.linspace(-0.746,0,1000)-1
  X, Y = np.meshgrid(x, y)
  Z = -1.0716*(Y+1)
  solid = ax.plot_surface(X,Y,Z,cmap=cm.coolwarm,linewidth=0, antialiased=True)
  
  y = np.linspace(-1.746,1,1000)
  x = np.linspace(0,0.604,1000) + 2.5
  X, Y = np.meshgrid(x, y)
  Z = 1.323*(X-2.5)
  solid = ax.plot_surface(X,Y,Z,cmap=cm.coolwarm,linewidth=0, antialiased=True)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/QFPzH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QFPzH.png" alt="enter image description here" /></a></p>
  <p>My original plan was to plot those two &quot;corner&quot; regions separately as triangles that I know the vertices, however, it was not clear how could I adopt the same color mapping that I desire since the convenient way to do these triangular regions is to set a limited plane, for example, this <a href="https://i.stack.imgur.com/QFPzH.png" rel="nofollow noreferrer">question</a>, where the triangle is defined by setting <code>Z[Z&lt;0]=0</code>.</p>
  <p>The problem is that I don't know how to set a similar condition to define my triangular region since it depends on a line inside that plane, which is not a constant as in the other question. All the points where the intersections between the planes occur can be calculated, I just don't know how do I set this visualization on Python. Thank you in advance!</p>