Obtain the maximum and minimum values of a plot's color map

14 views
Skip to first unread message

James Bowery

unread,
Mar 29, 2018, 12:45:51 PM3/29/18
to sage-support

Is there some way to obtain the maximum and minimum colormap function values from the resulting plot?

Colormap functions must return a value between 0 and 1.  Therefore, if one is trying to color map a function, one must know the maximum and minimum value of that function over the plotted domain.  For example, I've got a color-mapped plot:

theta,phi = var('theta phi')
cm
= colormaps.coolwarm
def c(theta,phi): return ((2/3)*(1+sin(theta)*sin(phi))-(1/3)*(1+sin(theta)*cos(phi))-(1/3)*(1+cos(theta)));
spherical_plot3d
(2,(theta,0,2*pi),(phi,0,pi),color=(c,cm))

Since sphereical_plot3d evaluates all of the colormap function values, it should be able to return the maximum and minimum.  That would enable me to offset and scale the colormap function.

Reply all
Reply to author
Forward
0 new messages