import numpy as np
from komorebi_browser import show_plot

x = np.linspace(-2, 2, 41)
y = np.linspace(-2, 2, 41)
X, Y = np.meshgrid(x, y)
Z = X**2 - Y**2
show_plot([{"type": "surface", "x": x, "y": y, "z": Z,
            "colorscale": "Viridis", "name": "Saddle"}],
          {"title": {"text": "Saddle surface: z = x² − y²"},
           "scene": {"xaxis": {"title": {"text": "x"}},
                     "yaxis": {"title": {"text": "y"}},
                     "zaxis": {"title": {"text": "z"}}}},
          description="A saddle rises along the x direction and falls along the y direction. The origin has height zero.")
print("Surface grid: 41 x 41")
print("Center height:", Z[20, 20])
