@@ -631,3 +631,49 @@ def test_right_panel_and_right_colorbar_border_priority():
631631 assert axi not in right_borders
632632 # Either the panel or the colorbar axes should be recognized as a right border
633633 assert (pax in right_borders ) or (cbar .ax in right_borders )
634+
635+
636+ @pytest .mark .mpl_image_compare
637+ def test_grid_geo_and_cartesian ():
638+ """
639+ Check that sharing geo and cartesian axes in a grid works.
640+ For a grid like
641+
642+ | 1 | 2 |
643+ | 3 | 4 |
644+ We expect the 2nd plot to be a bottom edge and 4 too if 4 is a geo axes.
645+ """
646+
647+ layout = [[1 , 2 ], [3 , 4 ]]
648+ fig , axs = uplt .subplots (layout , proj = (None , None , None , "cyl" ))
649+ axs [- 1 ].format (
650+ land = True ,
651+ ocean = True ,
652+ landcolor = "green" ,
653+ oceancolor = "ocean blue" ,
654+ title = "Cylindrical Projection" ,
655+ lonlabels = True ,
656+ latlabels = True ,
657+ grid = 0 ,
658+ )
659+ outer_axes = fig ._get_border_axes ()
660+ assert axs [0 ] in outer_axes ["top" ]
661+ assert axs [1 ] in outer_axes ["top" ]
662+ assert axs [2 ] not in outer_axes ["top" ]
663+ assert axs [3 ] in outer_axes ["top" ]
664+
665+ assert axs [0 ] not in outer_axes ["bottom" ]
666+ assert axs [1 ] in outer_axes ["bottom" ]
667+ assert axs [2 ] in outer_axes ["bottom" ]
668+ assert axs [3 ] in outer_axes ["bottom" ]
669+
670+ assert axs [0 ] in outer_axes ["left" ]
671+ assert axs [1 ] not in outer_axes ["left" ]
672+ assert axs [2 ] in outer_axes ["left" ]
673+ assert axs [3 ] in outer_axes ["left" ]
674+
675+ assert axs [0 ] not in outer_axes ["right" ]
676+ assert axs [1 ] in outer_axes ["right" ]
677+ assert axs [2 ] in outer_axes ["right" ]
678+ assert axs [3 ] in outer_axes ["right" ]
679+ return fig
0 commit comments