Three different, undocumented, cases that I think should be the same:
-
plot_surface(..., shade=True, lightsource=..., cmap=..., facecolors="garbage") - uses LightSource.shade, which does some messy and unnecessary trig in LightSource.hillshade, using the orientation of the lightsource.
-
plot_surface(..., shade=True, lightsource=..., cmap=...) - uses _shade_colors, which does a more sensible vector-based approach, but hard-codes a [-1, -1, 0.5] normal vector, rather than respecting the lightsource direction.
-
plot_surface(..., shade=True, lightsource=..., facecolors="garbage") - as above
Regarding (2), I think that there is a typo in axes3d.py, and this change should be made:
# Shade the data
- if shade and cmap is not None and fcolors is not None:
+ if shade and cmap is not None and fcolors is None:
fcolors = self._shade_colors_lightsource(Z, cmap, lightsource)
It seems dumb to only calculate face colors if the user already asked for different ones.
Regarding (3) - I think it would be useful to unify the shading into a normal-vector based approach, which I might try in a later patch
Three different, undocumented, cases that I think should be the same:
plot_surface(..., shade=True, lightsource=..., cmap=..., facecolors="garbage")- usesLightSource.shade, which does some messy and unnecessary trig inLightSource.hillshade, using the orientation of the lightsource.plot_surface(..., shade=True, lightsource=..., cmap=...)- uses_shade_colors, which does a more sensible vector-based approach, but hard-codes a[-1, -1, 0.5]normal vector, rather than respecting the lightsource direction.plot_surface(..., shade=True, lightsource=..., facecolors="garbage")- as aboveRegarding (2), I think that there is a typo in
axes3d.py, and this change should be made:It seems dumb to only calculate face colors if the user already asked for different ones.
Regarding (3) - I think it would be useful to unify the shading into a normal-vector based approach, which I might try in a later patch