@@ -534,3 +534,48 @@ def test_backend_fallback_headful(tmpdir):
534
534
# The actual backend will depend on what's installed, but at least tkagg is
535
535
# present.
536
536
assert backend .strip ().lower () != "agg"
537
+
538
+ # Test cases for Bug 16583 - matplotlibrc validates some parameters wrongly
539
+
540
+ def test_xtickalign_validation_rcparams ():
541
+ with pytest .raises (ValueError ):
542
+ mpl .rcParams ['xtick.alignment' ] = 'top'
543
+
544
+ @check_figures_equal ()
545
+ def test_left_xtick (fig_test , fig_ref ):
546
+ labels = range (0 , 100 , 10 )
547
+
548
+ fig_test .subplots ()
549
+ ax1 = fig_test .axes
550
+ ax1 [0 ].set_xticklabels (labels , ha = 'left' )
551
+
552
+ mpl .rcParams ['xtick.alignment' ] = 'left'
553
+ fig_ref .subplots ()
554
+ ax2 = fig_ref .axes
555
+ ax2 [0 ].set_xticklabels (labels )
556
+
557
+ @check_figures_equal ()
558
+ def test_right_xtick (fig_test , fig_ref ):
559
+ labels = range (0 , 100 , 10 )
560
+
561
+ fig_test .subplots ()
562
+ ax1 = fig_test .axes
563
+ ax1 [0 ].set_xticklabels (labels , ha = 'right' )
564
+
565
+ mpl .rcParams ['xtick.alignment' ] = 'right'
566
+ fig_ref .subplots ()
567
+ ax2 = fig_ref .axes
568
+ ax2 [0 ].set_xticklabels (labels )
569
+
570
+ @check_figures_equal ()
571
+ def test_center_xtick (fig_test , fig_ref ):
572
+ labels = range (0 , 100 , 10 )
573
+
574
+ fig_test .subplots ()
575
+ ax1 = fig_test .axes
576
+ ax1 [0 ].set_xticklabels (labels , ha = 'center' )
577
+
578
+ mpl .rcParams ['xtick.alignment' ] = 'center'
579
+ fig_ref .subplots ()
580
+ ax2 = fig_ref .axes
581
+ ax2 [0 ].set_xticklabels (labels )
0 commit comments