@@ -486,6 +486,34 @@ def test_sine(self):
486
486
assert numLinesRaw - numLinesClean == 39
487
487
488
488
489
+ class Test_subplots :
490
+ def test_subplot (self ):
491
+ from tikzplotlib import get_tikz_code
492
+
493
+ x = np .linspace (1 , 100 , 20 )
494
+ y = np .linspace (1 , 100 , 20 )
495
+
496
+ with plt .rc_context (rc = RC_PARAMS ):
497
+ fig , axes = plt .subplots (2 , 2 , figsize = (5 , 5 ))
498
+ plotstyles = [("-" , "o" ), ("-" , "None" ), ("None" , "o" ), ("--" , "x" )]
499
+ for ax , style in zip (axes .ravel (), plotstyles ):
500
+ ax .plot (x , y , linestyle = style [0 ], marker = style [1 ])
501
+ ax .set_ylim ([20 , 80 ])
502
+ ax .set_xlim ([20 , 80 ])
503
+ raw = get_tikz_code ()
504
+
505
+ cleanfigure .cleanfigure (fig )
506
+ clean = get_tikz_code ()
507
+
508
+ # Use number of lines to test if it worked.
509
+ # the baseline (raw) should have 20 points
510
+ # the clean version (clean) should have 2 points
511
+ # the difference in line numbers should therefore be 2
512
+ numLinesRaw = raw .count ("\n " )
513
+ numLinesClean = clean .count ("\n " )
514
+ assert numLinesRaw - numLinesClean == 36
515
+
516
+
489
517
def test_segmentVisible ():
490
518
"""test against matlab2tikz implementation
491
519
0 commit comments