@@ -147,6 +147,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
147147 ! isNumeric ( y0 ) ||
148148 ! isNumeric ( y1 )
149149 ) ;
150+
150151 // display zeros if line.width > 0
151152 if ( isBlank && shouldDisplayZeros && helpers . getLineWidth ( trace , di ) && ( isHorizontal ? x1 - x0 === 0 : y1 - y0 === 0 ) ) {
152153 isBlank = false ;
@@ -190,7 +191,9 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
190191 d3 . round ( Math . round ( v ) - offset , 2 ) : v ;
191192 }
192193
193- function expandToVisible ( v , vc ) {
194+ function expandToVisible ( v , vc , hideZeroHeight ) {
195+ if ( hideZeroHeight && v === vc ) return v ;
196+
194197 // if it's not in danger of disappearing entirely,
195198 // round more precisely
196199 return Math . abs ( v - vc ) >= 2 ? roundWithLine ( v ) :
@@ -210,10 +213,11 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
210213
211214 var op = Color . opacity ( mc ) ;
212215 var fixpx = ( op < 1 || lw > 0.01 ) ? roundWithLine : expandToVisible ;
213- x0 = fixpx ( x0 , x1 ) ;
214- x1 = fixpx ( x1 , x0 ) ;
215- y0 = fixpx ( y0 , y1 ) ;
216- y1 = fixpx ( y1 , y0 ) ;
216+
217+ x0 = fixpx ( x0 , x1 , isHorizontal ) ;
218+ x1 = fixpx ( x1 , x0 , isHorizontal ) ;
219+ y0 = fixpx ( y0 , y1 , ! isHorizontal ) ;
220+ y1 = fixpx ( y1 , y0 , ! isHorizontal ) ;
217221 }
218222
219223 var sel = transition ( Lib . ensureSingle ( bar , 'path' ) , fullLayout , opts , makeOnCompleteCallback ) ;
0 commit comments