Skip to content

Commit c5a92c1

Browse files
adding close figure to make pandas test work
1 parent 28732b2 commit c5a92c1

File tree

1 file changed

+5
-50
lines changed

1 file changed

+5
-50
lines changed

test/test_cleanfigure.py

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
RC_PARAMS = {"figure.figsize": [5, 5], "figure.dpi": 220, "pgf.rcfonts": False}
99

1010

11-
def test_recursive_cleanfigure():
12-
""" """
11+
def test_clean_figure():
1312
x = np.linspace(1, 100, 20)
1413
y = np.linspace(1, 100, 20)
1514

@@ -18,7 +17,7 @@ def test_recursive_cleanfigure():
1817
(l,) = ax.plot(x, y)
1918
ax.set_ylim([20, 80])
2019
ax.set_xlim([20, 80])
21-
cleanfigure._recursive_cleanfigure(fig)
20+
cleanfigure.clean_figure(fig)
2221
plt.close("all")
2322

2423

@@ -217,8 +216,6 @@ def test_movePointsCloser():
217216
set(gcf,'Position',[2.5 2.5 5 5])
218217
cleanfigure;
219218
```
220-
221-
222219
"""
223220
x = np.linspace(1, 100, 20)
224221
y = np.linspace(1, 100, 20)
@@ -250,8 +247,6 @@ def test_simplifyLine():
250247
set(gcf,'Position',[2.5 2.5 5 5])
251248
cleanfigure;
252249
```
253-
254-
255250
"""
256251
x = np.linspace(1, 100, 20)
257252
y = np.linspace(1, 100, 20)
@@ -285,8 +280,6 @@ def test_limitPrecision():
285280
set(gcf,'Position',[2.5 2.5 5 5])
286281
cleanfigure;
287282
```
288-
289-
290283
"""
291284
x = np.linspace(1, 100, 20)
292285
y = np.linspace(1, 100, 20)
@@ -323,8 +316,6 @@ def test_opheimSimplify():
323316
set(gcf,'Position',[2.5 2.5 5 5])
324317
cleanfigure;
325318
```
326-
327-
328319
"""
329320
x = np.array(
330321
[
@@ -353,12 +344,6 @@ def test_opheimSimplify():
353344
"function, result", [("plot", False), ("step", True)],
354345
)
355346
def test_is_step(function, result):
356-
"""
357-
358-
:param function:
359-
:param result:
360-
361-
"""
362347
x = np.linspace(1, 100, 20)
363348
y = np.linspace(1, 100, 20)
364349

@@ -376,8 +361,6 @@ class Test_plottypes:
376361
"""Testing plot types found here https://matplotlib.org/3.1.1/tutorials/introductory/sample_plots.html"""
377362

378363
def test_plot(self):
379-
""" """
380-
381364
x = np.linspace(1, 100, 20)
382365
y = np.linspace(1, 100, 20)
383366

@@ -401,8 +384,6 @@ def test_plot(self):
401384
plt.close("all")
402385

403386
def test_step(self):
404-
""" """
405-
406387
x = np.linspace(1, 100, 20)
407388
y = np.linspace(1, 100, 20)
408389

@@ -416,9 +397,7 @@ def test_step(self):
416397
plt.close("all")
417398

418399
def test_scatter(self):
419-
""" """
420400
# TODO: scatter plots are represented through axes.collections. Currently, this is simply ignored and nothing is done.
421-
422401
x = np.linspace(1, 100, 20)
423402
y = np.linspace(1, 100, 20)
424403
with plt.rc_context(rc=RC_PARAMS):
@@ -431,8 +410,6 @@ def test_scatter(self):
431410
plt.close("all")
432411

433412
def test_bar(self):
434-
""" """
435-
436413
x = np.linspace(1, 100, 20)
437414
y = np.linspace(1, 100, 20)
438415
with plt.rc_context(rc=RC_PARAMS):
@@ -446,7 +423,6 @@ def test_bar(self):
446423

447424
def test_hist(self):
448425
"""creates same test case as bar"""
449-
450426
x = np.linspace(1, 100, 20)
451427
y = np.linspace(1, 100, 20)
452428
with plt.rc_context(rc=RC_PARAMS):
@@ -459,8 +435,6 @@ def test_hist(self):
459435
plt.close("all")
460436

461437
def test_plot3d(self):
462-
""" """
463-
464438
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
465439
z = np.linspace(-2, 2, 100)
466440
r = z ** 2 + 1
@@ -487,8 +461,6 @@ def test_plot3d(self):
487461
plt.close("all")
488462

489463
def test_scatter3d(self):
490-
""" """
491-
492464
x, y = np.meshgrid(np.linspace(1, 100, 20), np.linspace(1, 100, 20))
493465
z = np.abs(x - 50) + np.abs(y - 50)
494466

@@ -521,7 +493,6 @@ def test_wireframe3D(self):
521493
plt.close("all")
522494

523495
def test_surface3D(self):
524-
""" """
525496
from matplotlib import cm
526497
from matplotlib.ticker import LinearLocator, FormatStrFormatter
527498

@@ -554,10 +525,7 @@ def test_surface3D(self):
554525
plt.close("all")
555526

556527
def test_trisurface3D(self):
557-
"""
558-
559-
:param Self:
560-
528+
""":param Self:
561529
"""
562530
import matplotlib.pyplot as plt
563531
import numpy as np
@@ -590,7 +558,6 @@ def test_trisurface3D(self):
590558
plt.close("all")
591559

592560
def test_contour3D(self):
593-
""" """
594561
from mpl_toolkits.mplot3d import axes3d
595562
import matplotlib.pyplot as plt
596563
from matplotlib import cm
@@ -606,7 +573,6 @@ def test_contour3D(self):
606573
plt.close("all")
607574

608575
def test_polygon3D(self):
609-
""" """
610576
from matplotlib.collections import PolyCollection
611577
from matplotlib import colors as mcolors
612578

@@ -647,7 +613,6 @@ def cc(arg):
647613
plt.close("all")
648614

649615
def test_bar3D(self):
650-
""" """
651616
import matplotlib.pyplot as plt
652617
import numpy as np
653618

@@ -672,7 +637,6 @@ def test_bar3D(self):
672637
plt.close("all")
673638

674639
def test_quiver3D(self):
675-
""" """
676640
import matplotlib.pyplot as plt
677641
import numpy as np
678642

@@ -703,7 +667,6 @@ def test_quiver3D(self):
703667
plt.close("all")
704668

705669
def test_2D_in_3D(self):
706-
""" """
707670
import numpy as np
708671
import matplotlib.pyplot as plt
709672

@@ -750,10 +713,7 @@ class Test_lineplot:
750713
def test_line_no_markers(self):
751714
"""test high-level usage for simple example.
752715
Test is successfull if generated tikz code saves correct amount of lines
753-
754-
755716
"""
756-
757717
x = np.linspace(1, 100, 20)
758718
y = np.linspace(1, 100, 20)
759719

@@ -779,8 +739,6 @@ def test_line_no_markers(self):
779739
def test_no_line_markers(self):
780740
"""test high-level usage for simple example.
781741
Test is successfull if generated tikz code saves correct amount of lines
782-
783-
784742
"""
785743

786744
x = np.linspace(1, 100, 20)
@@ -808,10 +766,7 @@ def test_no_line_markers(self):
808766
def test_line_markers(self):
809767
"""test high-level usage for simple example.
810768
Test is successfull if generated tikz code saves correct amount of lines
811-
812-
813769
"""
814-
815770
x = np.linspace(1, 100, 20)
816771
y = np.linspace(1, 100, 20)
817772

@@ -835,8 +790,6 @@ def test_line_markers(self):
835790
plt.close("all")
836791

837792
def test_sine(self):
838-
""" """
839-
840793
x = np.linspace(1, 2 * np.pi, 100)
841794
y = np.sin(8 * x)
842795

@@ -1047,6 +1000,7 @@ def test_getHeightWidthInPixels():
10471000
assert w == 600 and h == 400
10481001
w, h = cleanfigure._get_width_height_in_pixels(fig, 600)
10491002
assert w == h
1003+
plt.close("all")
10501004

10511005

10521006
def test_memory():
@@ -1056,3 +1010,4 @@ def test_memory():
10561010

10571011
plt.plot(np.arange(100000))
10581012
tikzplotlib.clean_figure()
1013+
plt.close("all")

0 commit comments

Comments
 (0)