Skip to content

Commit 28732b2

Browse files
fix N**2 memory complexity bug
1 parent 99a2c9d commit 28732b2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

test/test_cleanfigure.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,3 +1047,12 @@ def test_getHeightWidthInPixels():
10471047
assert w == 600 and h == 400
10481048
w, h = cleanfigure._get_width_height_in_pixels(fig, 600)
10491049
assert w == h
1050+
1051+
1052+
def test_memory():
1053+
import matplotlib.pyplot as plt
1054+
import numpy as np
1055+
import tikzplotlib
1056+
1057+
plt.plot(np.arange(100000))
1058+
tikzplotlib.clean_figure()

tikzplotlib/_cleanfigure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ def _segment_visible(data, dataIsInBox, xLim, yLim):
949949
:type yLim: list, np.array
950950
"""
951951
n = np.shape(data)[0]
952-
mask = np.zeros((n - 1, n)) == 1
952+
mask = np.zeros((n - 1, 1)) == 1
953953

954954
# Only check if there is more than 1 point
955955
if n > 1:

0 commit comments

Comments
 (0)