File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ module.exports = function makeColorMap(trace) {
2929
3030 var si , i ;
3131
32- if ( contours . coloring === 'heatmap' ) {
33- var zmin0 = cOpts . min ;
34- var zmax0 = cOpts . max ;
32+ var zmin0 = cOpts . min ;
33+ var zmax0 = cOpts . max ;
3534
35+ if ( contours . coloring === 'heatmap' ) {
3636 for ( i = 0 ; i < len ; i ++ ) {
3737 si = scl [ i ] ;
3838 domain [ i ] = si [ 0 ] * ( zmax0 - zmin0 ) + zmin0 ;
@@ -65,6 +65,18 @@ module.exports = function makeColorMap(trace) {
6565 domain [ i ] = ( si [ 0 ] * ( nc + extra - 1 ) - ( extra / 2 ) ) * cs + start ;
6666 range [ i ] = si [ 1 ] ;
6767 }
68+
69+ // Ensure zmin and zmax are included in the colorscale
70+
71+ if ( domain [ 0 ] > zmin0 ) {
72+ domain . unshift ( zmin0 ) ;
73+ range . unshift ( range [ 0 ] ) ;
74+ }
75+
76+ if ( domain [ domain . length - 1 ] < zmax0 ) {
77+ domain . push ( zmax0 ) ;
78+ range . push ( range [ range . length - 1 ] ) ;
79+ }
6880 }
6981
7082 return Colorscale . makeColorScaleFunc (
You can’t perform that action at this time.
0 commit comments