I have the following Python code:
import numpy as np
from matplotlib import pyplot as plt
plt.rcParams['figure.figsize'] = [12, 7]
n = 100
m = 100
X = np.arange(-n/2,n/2,1)
Y = np.arange(-m/2,m/2,1)
X, Y = np.meshgrid(X, Y)
landscape = np.exp(-0.01 * (X*X + Y*Y) )
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
ax.plot_surface(X, Y, landscape,
linewidth=0,
antialiased=False
)
Running this in a notebook produces this image
If you look very closely you will see that the left-hand side of the Gaussian peak is very slightly lighter than the right-hand side. This lighting effect is barely visible, though, and I would like to increase it, so that the 3D shape becomes easily visible.
I'm aware of matplotlib.colors.LightSource, but no matter what I do I can't get that to produce the effect I want. Ideally, I'd just like to increase the intensity of the 'default' lighting, rather than fiddling around with this. But if someone can explain how to use LightSource for this image that would help too.
Note that I don't want to apply a height map to the image, and I also don't want to draw grid lines on it - I just want to increase the lighting effect while keeping the surface a uniform colour.
It's also worth mentioning that I'm somewhat stuck with MatPlotLib, because I'm using Jupyterlite to share the notebook with students who don't have Python installed, so I need a solution that works with that.



