@@ -1031,6 +1031,34 @@ def test_subfigure_spanning():
1031
1031
np .testing .assert_allclose (sub_figs [2 ].bbox .max , [w , h / 3 ])
1032
1032
1033
1033
1034
+ @mpl .style .context ('mpl20' )
1035
+ def test_subfigure_ticks ():
1036
+ # This tests a tick-spacing error that only seems applicable
1037
+ # when the subfigures are saved to file. Its very hard to replicate
1038
+ fig = plt .figure (constrained_layout = True , figsize = (10 , 3 ))
1039
+ # create left/right subfigs nested in bottom subfig
1040
+ (subfig_bl , subfig_br ) = fig .subfigures (1 , 2 , wspace = 0.01 ,
1041
+ width_ratios = [7 , 2 ])
1042
+
1043
+ # put ax1-ax3 in gridspec of bottom-left subfig
1044
+ gs = subfig_bl .add_gridspec (nrows = 1 , ncols = 14 )
1045
+
1046
+ ax1 = subfig_bl .add_subplot (gs [0 , :1 ])
1047
+ ax1 .scatter (x = [- 56.46881504821776 , 24.179891162109396 ], y = [1500 , 3600 ])
1048
+
1049
+ ax2 = subfig_bl .add_subplot (gs [0 , 1 :3 ], sharey = ax1 )
1050
+ ax2 .scatter (x = [- 126.5357270050049 , 94.68456736755368 ], y = [1500 , 3600 ])
1051
+ ax3 = subfig_bl .add_subplot (gs [0 , 3 :14 ], sharey = ax1 )
1052
+
1053
+ fig .set_dpi (120 )
1054
+ fig .draw_no_output ()
1055
+ ticks120 = ax2 .get_xticks ()
1056
+ fig .set_dpi (300 )
1057
+ fig .draw_no_output ()
1058
+ ticks300 = ax2 .get_xticks ()
1059
+ np .testing .assert_allclose (ticks120 , ticks300 )
1060
+
1061
+
1034
1062
def test_add_subplot_kwargs ():
1035
1063
# fig.add_subplot() always creates new axes, even if axes kwargs differ.
1036
1064
fig = plt .figure ()
0 commit comments