Skip to content

Commit 72e0433

Browse files
fixed bug in simplifyLine
1 parent 5bd255b commit 72e0433

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tikzplotlib/cleanfigure.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ def simplifyLine(fighandle, axhandle, linehandle, target_resolution):
793793
numLines = np.size(lineStart)
794794

795795
# original_code : id_remove = cell(numLines, 1)
796-
id_remove = [[] * numLines]
796+
id_remove = [np.array([], dtype=np.int32).reshape((-1, ))] * numLines
797797

798798
# Simplify the line segments
799799
for ii in np.arange(numLines):
@@ -804,15 +804,13 @@ def simplifyLine(fighandle, axhandle, linehandle, target_resolution):
804804
# Line simplification
805805
if np.size(x) > 2:
806806
mask = opheimSimplify(x, y, tol)
807-
id_remove[ii] = np.argwhere(mask == 0) + lineStart[ii]
807+
id_remove[ii] = np.argwhere(mask == 0).reshape((-1, )) + lineStart[ii]
808808
# Merge the indices of the line segments
809809
# original code : id_remove = cat(1, id_remove{:})
810810
id_remove = np.concatenate(id_remove)
811811

812812
# remove the data points
813-
data = removeData(data, id_remove)
814-
linehandle.set_xdata(data[:, 0])
815-
linehandle.set_ydata(data[:, 1])
813+
removeData(linehandle, id_remove)
816814

817815

818816
def simplifyStairs(fighandle, axhandle, linehandle):

0 commit comments

Comments
 (0)