8
8
RC_PARAMS = {"figure.figsize" : [5 , 5 ], "figure.dpi" : 220 , "pgf.rcfonts" : False }
9
9
10
10
11
- def test_recursive_cleanfigure ():
12
- """ """
11
+ def test_clean_figure ():
13
12
x = np .linspace (1 , 100 , 20 )
14
13
y = np .linspace (1 , 100 , 20 )
15
14
@@ -18,7 +17,7 @@ def test_recursive_cleanfigure():
18
17
(l ,) = ax .plot (x , y )
19
18
ax .set_ylim ([20 , 80 ])
20
19
ax .set_xlim ([20 , 80 ])
21
- cleanfigure ._recursive_cleanfigure (fig )
20
+ cleanfigure .clean_figure (fig )
22
21
plt .close ("all" )
23
22
24
23
@@ -217,8 +216,6 @@ def test_movePointsCloser():
217
216
set(gcf,'Position',[2.5 2.5 5 5])
218
217
cleanfigure;
219
218
```
220
-
221
-
222
219
"""
223
220
x = np .linspace (1 , 100 , 20 )
224
221
y = np .linspace (1 , 100 , 20 )
@@ -250,8 +247,6 @@ def test_simplifyLine():
250
247
set(gcf,'Position',[2.5 2.5 5 5])
251
248
cleanfigure;
252
249
```
253
-
254
-
255
250
"""
256
251
x = np .linspace (1 , 100 , 20 )
257
252
y = np .linspace (1 , 100 , 20 )
@@ -285,8 +280,6 @@ def test_limitPrecision():
285
280
set(gcf,'Position',[2.5 2.5 5 5])
286
281
cleanfigure;
287
282
```
288
-
289
-
290
283
"""
291
284
x = np .linspace (1 , 100 , 20 )
292
285
y = np .linspace (1 , 100 , 20 )
@@ -323,8 +316,6 @@ def test_opheimSimplify():
323
316
set(gcf,'Position',[2.5 2.5 5 5])
324
317
cleanfigure;
325
318
```
326
-
327
-
328
319
"""
329
320
x = np .array (
330
321
[
@@ -353,12 +344,6 @@ def test_opheimSimplify():
353
344
"function, result" , [("plot" , False ), ("step" , True )],
354
345
)
355
346
def test_is_step (function , result ):
356
- """
357
-
358
- :param function:
359
- :param result:
360
-
361
- """
362
347
x = np .linspace (1 , 100 , 20 )
363
348
y = np .linspace (1 , 100 , 20 )
364
349
@@ -376,8 +361,6 @@ class Test_plottypes:
376
361
"""Testing plot types found here https://matplotlib.org/3.1.1/tutorials/introductory/sample_plots.html"""
377
362
378
363
def test_plot (self ):
379
- """ """
380
-
381
364
x = np .linspace (1 , 100 , 20 )
382
365
y = np .linspace (1 , 100 , 20 )
383
366
@@ -401,8 +384,6 @@ def test_plot(self):
401
384
plt .close ("all" )
402
385
403
386
def test_step (self ):
404
- """ """
405
-
406
387
x = np .linspace (1 , 100 , 20 )
407
388
y = np .linspace (1 , 100 , 20 )
408
389
@@ -416,9 +397,7 @@ def test_step(self):
416
397
plt .close ("all" )
417
398
418
399
def test_scatter (self ):
419
- """ """
420
400
# TODO: scatter plots are represented through axes.collections. Currently, this is simply ignored and nothing is done.
421
-
422
401
x = np .linspace (1 , 100 , 20 )
423
402
y = np .linspace (1 , 100 , 20 )
424
403
with plt .rc_context (rc = RC_PARAMS ):
@@ -431,8 +410,6 @@ def test_scatter(self):
431
410
plt .close ("all" )
432
411
433
412
def test_bar (self ):
434
- """ """
435
-
436
413
x = np .linspace (1 , 100 , 20 )
437
414
y = np .linspace (1 , 100 , 20 )
438
415
with plt .rc_context (rc = RC_PARAMS ):
@@ -446,7 +423,6 @@ def test_bar(self):
446
423
447
424
def test_hist (self ):
448
425
"""creates same test case as bar"""
449
-
450
426
x = np .linspace (1 , 100 , 20 )
451
427
y = np .linspace (1 , 100 , 20 )
452
428
with plt .rc_context (rc = RC_PARAMS ):
@@ -459,8 +435,6 @@ def test_hist(self):
459
435
plt .close ("all" )
460
436
461
437
def test_plot3d (self ):
462
- """ """
463
-
464
438
theta = np .linspace (- 4 * np .pi , 4 * np .pi , 100 )
465
439
z = np .linspace (- 2 , 2 , 100 )
466
440
r = z ** 2 + 1
@@ -487,8 +461,6 @@ def test_plot3d(self):
487
461
plt .close ("all" )
488
462
489
463
def test_scatter3d (self ):
490
- """ """
491
-
492
464
x , y = np .meshgrid (np .linspace (1 , 100 , 20 ), np .linspace (1 , 100 , 20 ))
493
465
z = np .abs (x - 50 ) + np .abs (y - 50 )
494
466
@@ -521,7 +493,6 @@ def test_wireframe3D(self):
521
493
plt .close ("all" )
522
494
523
495
def test_surface3D (self ):
524
- """ """
525
496
from matplotlib import cm
526
497
from matplotlib .ticker import LinearLocator , FormatStrFormatter
527
498
@@ -554,10 +525,7 @@ def test_surface3D(self):
554
525
plt .close ("all" )
555
526
556
527
def test_trisurface3D (self ):
557
- """
558
-
559
- :param Self:
560
-
528
+ """:param Self:
561
529
"""
562
530
import matplotlib .pyplot as plt
563
531
import numpy as np
@@ -590,7 +558,6 @@ def test_trisurface3D(self):
590
558
plt .close ("all" )
591
559
592
560
def test_contour3D (self ):
593
- """ """
594
561
from mpl_toolkits .mplot3d import axes3d
595
562
import matplotlib .pyplot as plt
596
563
from matplotlib import cm
@@ -606,7 +573,6 @@ def test_contour3D(self):
606
573
plt .close ("all" )
607
574
608
575
def test_polygon3D (self ):
609
- """ """
610
576
from matplotlib .collections import PolyCollection
611
577
from matplotlib import colors as mcolors
612
578
@@ -647,7 +613,6 @@ def cc(arg):
647
613
plt .close ("all" )
648
614
649
615
def test_bar3D (self ):
650
- """ """
651
616
import matplotlib .pyplot as plt
652
617
import numpy as np
653
618
@@ -672,7 +637,6 @@ def test_bar3D(self):
672
637
plt .close ("all" )
673
638
674
639
def test_quiver3D (self ):
675
- """ """
676
640
import matplotlib .pyplot as plt
677
641
import numpy as np
678
642
@@ -703,7 +667,6 @@ def test_quiver3D(self):
703
667
plt .close ("all" )
704
668
705
669
def test_2D_in_3D (self ):
706
- """ """
707
670
import numpy as np
708
671
import matplotlib .pyplot as plt
709
672
@@ -750,10 +713,7 @@ class Test_lineplot:
750
713
def test_line_no_markers (self ):
751
714
"""test high-level usage for simple example.
752
715
Test is successfull if generated tikz code saves correct amount of lines
753
-
754
-
755
716
"""
756
-
757
717
x = np .linspace (1 , 100 , 20 )
758
718
y = np .linspace (1 , 100 , 20 )
759
719
@@ -779,8 +739,6 @@ def test_line_no_markers(self):
779
739
def test_no_line_markers (self ):
780
740
"""test high-level usage for simple example.
781
741
Test is successfull if generated tikz code saves correct amount of lines
782
-
783
-
784
742
"""
785
743
786
744
x = np .linspace (1 , 100 , 20 )
@@ -808,10 +766,7 @@ def test_no_line_markers(self):
808
766
def test_line_markers (self ):
809
767
"""test high-level usage for simple example.
810
768
Test is successfull if generated tikz code saves correct amount of lines
811
-
812
-
813
769
"""
814
-
815
770
x = np .linspace (1 , 100 , 20 )
816
771
y = np .linspace (1 , 100 , 20 )
817
772
@@ -835,8 +790,6 @@ def test_line_markers(self):
835
790
plt .close ("all" )
836
791
837
792
def test_sine (self ):
838
- """ """
839
-
840
793
x = np .linspace (1 , 2 * np .pi , 100 )
841
794
y = np .sin (8 * x )
842
795
@@ -1047,6 +1000,7 @@ def test_getHeightWidthInPixels():
1047
1000
assert w == 600 and h == 400
1048
1001
w , h = cleanfigure ._get_width_height_in_pixels (fig , 600 )
1049
1002
assert w == h
1003
+ plt .close ("all" )
1050
1004
1051
1005
1052
1006
def test_memory ():
@@ -1056,3 +1010,4 @@ def test_memory():
1056
1010
1057
1011
plt .plot (np .arange (100000 ))
1058
1012
tikzplotlib .clean_figure ()
1013
+ plt .close ("all" )
0 commit comments