@@ -2646,6 +2646,8 @@ function makePlotFramework(gd) {
26462646 . classed ( 'layer-below' , true ) ;
26472647 fullLayout . _shapeLowerLayer = layerBelow . append ( 'g' )
26482648 . classed ( 'shapelayer' , true ) ;
2649+ fullLayout . _imageLowerLayer = layerBelow . append ( 'g' )
2650+ . classed ( 'imagelayer' , true ) ;
26492651
26502652 var subplots = Plotly . Axes . getSubplots ( gd ) ;
26512653 if ( subplots . join ( '' ) !== Object . keys ( gd . _fullLayout . _plots || { } ) . join ( '' ) ) {
@@ -2658,15 +2660,18 @@ function makePlotFramework(gd) {
26582660 fullLayout . _ternarylayer = fullLayout . _paper . append ( 'g' ) . classed ( 'ternarylayer' , true ) ;
26592661
26602662 // shape layers in subplots
2661- fullLayout . _subplotShapeLayer = fullLayout . _paper
2662- . selectAll ( '.shapelayer-subplot' ) ;
2663+ var layerSubplot = fullLayout . _paper . selectAll ( '.layer-subplot' ) ;
2664+ fullLayout . _shapeSubplotLayer = layerSubplot . selectAll ( '.shapelayer' ) ;
2665+ fullLayout . _imageSubplotLayer = layerSubplot . selectAll ( '.imagelayer' ) ;
26632666
26642667 // upper shape layer
26652668 // (only for shapes to be drawn above the whole plot, including subplots)
26662669 var layerAbove = fullLayout . _paper . append ( 'g' )
26672670 . classed ( 'layer-above' , true ) ;
26682671 fullLayout . _shapeUpperLayer = layerAbove . append ( 'g' )
26692672 . classed ( 'shapelayer' , true ) ;
2673+ fullLayout . _imageUpperLayer = layerAbove . append ( 'g' )
2674+ . classed ( 'imagelayer' , true ) ;
26702675
26712676 // single pie layer for the whole plot
26722677 fullLayout . _pielayer = fullLayout . _paper . append ( 'g' ) . classed ( 'pielayer' , true ) ;
@@ -2797,10 +2802,16 @@ function makeCartesianPlotFramwork(gd, subplots) {
27972802 // the plot and containers for overlays
27982803 plotinfo . bg = plotgroup . append ( 'rect' )
27992804 . style ( 'stroke-width' , 0 ) ;
2800- // shape layer
2801- // (only for shapes to be drawn below a subplot)
2802- plotinfo . shapelayer = plotgroup . append ( 'g' )
2803- . classed ( 'shapelayer shapelayer-subplot' , true ) ;
2805+
2806+ // back layer for shapes and images to
2807+ // be drawn below a subplot
2808+ var backlayer = plotgroup . append ( 'g' )
2809+ . classed ( 'layer-subplot' , true ) ;
2810+
2811+ plotinfo . shapelayer = backlayer . append ( 'g' )
2812+ . classed ( 'shapelayer' , true ) ;
2813+ plotinfo . imagelayer = backlayer . append ( 'g' )
2814+ . classed ( 'imagelayer' , true ) ;
28042815 plotinfo . gridlayer = plotgroup . append ( 'g' ) ;
28052816 plotinfo . overgrid = plotgroup . append ( 'g' ) ;
28062817 plotinfo . zerolinelayer = plotgroup . append ( 'g' ) ;
0 commit comments