| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Wow, this was hard - because the tests ran perfectly fine locally. Turns out I stepped directly into numpy/numpy#16023 (np.array(["0"]).astype(bool) is False in all but the very recent numpy 1.18.3). |
Sorry, something went wrong.
| t = np.linspace(0, 3, 14) | ||
| y = np.random.rand(len(t)) | ||
|
|
||
| casesA = [None, 4, (2, 5), [1, 5, 11], |
There was a problem hiding this comment.
I think this would be more readable:
cases = [
(None, "11111111111111"),
(4, "10001000100010"),
...
]
for ax_test, ax_ref, (markevery, pattern) in zip(axs_test, axs_ref, cases):
ax_test.plot(t, y, "-gD", markevery=markevery)
ax_ref.plot(t, y, "-gD",
markevery=np.array(list(pattern)).astype(int).astype(bool))
Sorry, something went wrong.
| def test_markevery(fig_test, fig_ref): | ||
| np.random.seed(42) | ||
| t = np.linspace(0, 3, 14) | ||
| y = np.random.rand(len(t)) |
There was a problem hiding this comment.
Optional: There is no gain from random numbers here. You could just use y = t**2 or any other simple function.
Sorry, something went wrong.
|
@timhoffm's suggested test changes look easy and worthwhile so I'm holding off on a review, but otherwise this looks good. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
This line
matplotlib/lib/matplotlib/lines.py
Line 583 in 9a9c8b8
prevents numpy arrays to be used as input to markevery, Because The truth value of an array with more than one element is ambiguous.
That's actually a regression that came in via #4091.
I think we would like to support numpy arrays wherever possible. So this PR just removes the check and sets the artist stale on every call to set_markevery.
Also creates tests for all possible cases that markevery can take.
PR Checklist