7
7
RC_PARAMS = {"figure.figsize" : [5 , 5 ], "figure.dpi" : 220 , "pgf.rcfonts" : False }
8
8
9
9
10
+ def test_recursive_cleanfigure ():
11
+ x = np .linspace (1 , 100 , 20 )
12
+ y = np .linspace (1 , 100 , 20 )
13
+
14
+ with plt .rc_context (rc = RC_PARAMS ):
15
+ fig , ax = plt .subplots (1 , 1 , figsize = (5 , 5 ))
16
+ (l ,) = ax .plot (x , y )
17
+ ax .set_ylim ([20 , 80 ])
18
+ ax .set_xlim ([20 , 80 ])
19
+ cleanfigure ._recursive_cleanfigure (fig )
20
+
21
+
10
22
def test_pruneOutsideBox ():
11
23
"""test against matlab2tikz implementation
12
24
@@ -389,7 +401,7 @@ def test_plot(self):
389
401
ax .set_xlim ([20 , 80 ])
390
402
raw = get_tikz_code ()
391
403
392
- cleanfigure .cleanfigure (fig , ax )
404
+ cleanfigure .cleanfigure (fig )
393
405
clean = get_tikz_code ()
394
406
395
407
# Use number of lines to test if it worked.
@@ -411,7 +423,7 @@ def test_step(self):
411
423
ax .set_ylim ([20 , 80 ])
412
424
ax .set_xlim ([20 , 80 ])
413
425
with pytest .warns (Warning ):
414
- cleanfigure .cleanfigure (fig , ax )
426
+ cleanfigure .cleanfigure (fig )
415
427
416
428
def test_scatter (self ):
417
429
# TODO: scatter plots are represented through axes.collections. Currently, this is simply ignored and nothing is done.
@@ -424,7 +436,7 @@ def test_scatter(self):
424
436
ax .set_ylim ([20 , 80 ])
425
437
ax .set_xlim ([20 , 80 ])
426
438
with pytest .warns (Warning ):
427
- cleanfigure .cleanfigure (fig , ax )
439
+ cleanfigure .cleanfigure (fig )
428
440
429
441
def test_bar (self ):
430
442
@@ -436,7 +448,7 @@ def test_bar(self):
436
448
ax .set_ylim ([20 , 80 ])
437
449
ax .set_xlim ([20 , 80 ])
438
450
with pytest .warns (Warning ):
439
- cleanfigure .cleanfigure (fig , ax )
451
+ cleanfigure .cleanfigure (fig )
440
452
441
453
def test_hist (self ):
442
454
"""creates same test case as bar"""
@@ -449,7 +461,7 @@ def test_hist(self):
449
461
ax .set_ylim ([20 , 80 ])
450
462
ax .set_xlim ([20 , 80 ])
451
463
with pytest .warns (Warning ):
452
- cleanfigure .cleanfigure (fig , ax )
464
+ cleanfigure .cleanfigure (fig )
453
465
454
466
def test_plot3d (self ):
455
467
from mpl_toolkits .mplot3d import Axes3D
@@ -469,7 +481,7 @@ def test_plot3d(self):
469
481
ax .view_init (30 , 30 )
470
482
raw = get_tikz_code (fig )
471
483
472
- cleanfigure .cleanfigure (fig , ax )
484
+ cleanfigure .cleanfigure (fig )
473
485
clean = get_tikz_code ()
474
486
475
487
# Use number of lines to test if it worked.
@@ -491,7 +503,7 @@ def test_scatter3d(self):
491
503
ax .set_ylim ([20 , 80 ])
492
504
ax .set_zlim ([0 , 80 ])
493
505
with pytest .warns (Warning ):
494
- cleanfigure .cleanfigure (fig , ax )
506
+ cleanfigure .cleanfigure (fig )
495
507
496
508
def test_wireframe3D (self ):
497
509
from mpl_toolkits .mplot3d import axes3d
@@ -505,7 +517,7 @@ def test_wireframe3D(self):
505
517
# Plot a basic wireframe.
506
518
ax .plot_wireframe (X , Y , Z , rstride = 10 , cstride = 10 )
507
519
with pytest .warns (Warning ):
508
- cleanfigure .cleanfigure (fig , ax )
520
+ cleanfigure .cleanfigure (fig )
509
521
510
522
def test_surface3D (self ):
511
523
from mpl_toolkits .mplot3d import Axes3D
@@ -535,7 +547,7 @@ def test_surface3D(self):
535
547
fig .colorbar (surf , shrink = 0.5 , aspect = 5 )
536
548
537
549
with pytest .warns (Warning ):
538
- cleanfigure .cleanfigure (fig , ax )
550
+ cleanfigure .cleanfigure (fig )
539
551
540
552
def test_trisurface3D (Self ):
541
553
from mpl_toolkits .mplot3d import Axes3D
@@ -567,7 +579,7 @@ def test_trisurface3D(Self):
567
579
568
580
ax .plot_trisurf (x , y , z , linewidth = 0.2 , antialiased = True )
569
581
with pytest .warns (Warning ):
570
- cleanfigure .cleanfigure (fig , ax )
582
+ cleanfigure .cleanfigure (fig )
571
583
572
584
def test_contour3D (self ):
573
585
from mpl_toolkits .mplot3d import axes3d
@@ -581,7 +593,7 @@ def test_contour3D(self):
581
593
cset = ax .contour (X , Y , Z , cmap = cm .coolwarm )
582
594
ax .clabel (cset , fontsize = 9 , inline = 1 )
583
595
with pytest .warns (Warning ):
584
- cleanfigure .cleanfigure (fig , ax )
596
+ cleanfigure .cleanfigure (fig )
585
597
586
598
def test_polygon3D (self ):
587
599
from mpl_toolkits .mplot3d import Axes3D
@@ -615,7 +627,7 @@ def cc(arg):
615
627
ax .set_zlabel ('Z' )
616
628
ax .set_zlim3d (0 , 1 )
617
629
with pytest .warns (Warning ):
618
- cleanfigure .cleanfigure (fig , ax )
630
+ cleanfigure .cleanfigure (fig )
619
631
620
632
def test_bar3D (self ):
621
633
from mpl_toolkits .mplot3d import Axes3D
@@ -640,7 +652,7 @@ def test_bar3D(self):
640
652
ax .set_ylabel ('Y' )
641
653
ax .set_zlabel ('Z' )
642
654
with pytest .warns (Warning ):
643
- cleanfigure .cleanfigure (fig , ax )
655
+ cleanfigure .cleanfigure (fig )
644
656
645
657
def test_quiver3D (self ):
646
658
from mpl_toolkits .mplot3d import axes3d
@@ -665,7 +677,7 @@ def test_quiver3D(self):
665
677
666
678
ax .quiver (x , y , z , u , v , w , length = 0.1 , normalize = True )
667
679
with pytest .warns (Warning ):
668
- cleanfigure .cleanfigure (fig , ax )
680
+ cleanfigure .cleanfigure (fig )
669
681
670
682
def test_2D_in_3D (self ):
671
683
from mpl_toolkits .mplot3d import Axes3D
@@ -705,7 +717,7 @@ def test_2D_in_3D(self):
705
717
# on the plane y=0
706
718
ax .view_init (elev = 20. , azim = - 35 )
707
719
with pytest .warns (Warning ):
708
- cleanfigure .cleanfigure (fig , ax )
720
+ cleanfigure .cleanfigure (fig )
709
721
710
722
711
723
class Test_lineplot :
@@ -724,7 +736,7 @@ def test_line_no_markers(self):
724
736
ax .set_xlim ([20 , 80 ])
725
737
raw = get_tikz_code ()
726
738
727
- cleanfigure .cleanfigure (fig , ax )
739
+ cleanfigure .cleanfigure (fig )
728
740
clean = get_tikz_code ()
729
741
730
742
# Use number of lines to test if it worked.
@@ -750,7 +762,7 @@ def test_no_line_markers(self):
750
762
ax .set_xlim ([20 , 80 ])
751
763
raw = get_tikz_code ()
752
764
753
- cleanfigure .cleanfigure (fig , ax )
765
+ cleanfigure .cleanfigure (fig )
754
766
clean = get_tikz_code ()
755
767
756
768
# Use number of lines to test if it worked.
@@ -776,7 +788,7 @@ def test_line_markers(self):
776
788
ax .set_xlim ([20 , 80 ])
777
789
raw = get_tikz_code ()
778
790
779
- cleanfigure .cleanfigure (fig , ax )
791
+ cleanfigure .cleanfigure (fig )
780
792
clean = get_tikz_code ()
781
793
782
794
# Use number of lines to test if it worked.
@@ -799,7 +811,7 @@ def test_sine(self):
799
811
ax .set_ylim ([- 1 , 1 ])
800
812
raw = get_tikz_code ()
801
813
802
- cleanfigure .cleanfigure (fig , ax )
814
+ cleanfigure .cleanfigure (fig )
803
815
clean = get_tikz_code ()
804
816
805
817
# Use number of lines to test if it worked.
0 commit comments