Skip to content

Commit

Permalink
Merge pull request #469 from csachs/nan_jump
Browse files Browse the repository at this point in the history
Change behavior for NaN to match matplotlib
  • Loading branch information
nschloe committed Apr 1, 2021
2 parents e478ab9 + eab8b46 commit c602916
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions test/test_cleanfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ def test_plot3d(self):
# Use number of lines to test if it worked.
numLinesRaw = raw.count("\n")
numLinesClean = clean.count("\n")

assert numLinesRaw - numLinesClean == 14
assert numLinesRaw - numLinesClean == 13
plt.close("all")

def test_scatter3d(self):
Expand Down Expand Up @@ -569,7 +568,7 @@ def test_loglog(self):
clean = get_tikz_code()
numLinesRaw = raw.count("\n")
numLinesClean = clean.count("\n")
assert numLinesRaw - numLinesClean == 98
assert numLinesRaw - numLinesClean == 99
assert numLinesClean == 27
plt.close("all")

Expand Down
4 changes: 2 additions & 2 deletions tikzplotlib/_line2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def _table(obj, data): # noqa: C901
plot_table = []
table_row_sep = data["table_row_sep"]
ydata[ydata_mask] = np.nan
if any(ydata_mask):
# matplotlib jumps at masked images, while PGFPlots by default interpolates.
if any(ydata_mask) or (~np.isfinite(ydata)).any():
# matplotlib jumps at masked or nan values, while PGFPlots by default interpolates.
# Hence, if we have a masked plot, make sure that PGFPlots jumps as well.
if "unbounded coords=jump" not in data["current axes"].axis_options:
data["current axes"].axis_options.append("unbounded coords=jump")
Expand Down

0 comments on commit c602916

Please sign in to comment.