1
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np

def figure():
    fig = plt.figure(figsize=(8,6))
    axes = fig.gca(projection='3d')
    x = np.linspace(-3, 3, 100)
    y = np.linspace(-3, 3, 100)
    x, y = np.meshgrid(x, y)

    f1 = lambda x, y: x**2 + y**2
    f2 = lambda x, y: (12 -x**2 -y**2)**0.5
    axes.plot_surface(x, y, f1(x, y), alpha=0.05)
    axes.plot_surface(x, y, f2(x, y), alpha=0.05)
    axes.set_xlim(-5,5)
    axes.set_ylim(-5,5)

figure()

enter image description here

I would like to somehow make the intersecting surfaces as dim as I can and bring out the body that is created via intersection. As things stand right now, this doesn't look too convincing and I am out of my element. How can I achieve what I described?

AlvinL
  • 438
  • 5
  • 24
  • See http://stackoverflow.com/questions/14824893/how-to-draw-diagrams-like-this/14825951#14825951 mpl's 3D support is functional, but limited. We do not have a depth-buffer when rendering so can not really plot intersecting 3D surfaces. – tacaswell Apr 12 '15 at 15:04

0 Answers0