-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow for null-strides in wireframe plot #3554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1741,8 +1741,14 @@ def plot_wireframe(self, X, Y, Z, *args, **kwargs): | |||
# This transpose will make it easy to obtain the columns. | |||
tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z) | |||
|
|||
rii = list(xrange(0, rows, rstride)) | |||
cii = list(xrange(0, cols, cstride)) | |||
if rii: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is undefined at this point, isn't it?
Doh. See now, sorry |
I think this is neat, but it needs a little bit of work. It would be fairly trivial to add a bit of validation that would raise a ValueError if both rstride and cstride were "false-y". The doc string should also be updated, along with some unit tests. |
Ok, I can do that. In regard to unit tests, would an error at tests if this error is raised be sufficient? I'm not really sure how to do testing on plot functions, since usually we just look at the plot to see if it works. |
Matplotlib's unit test suite is almost entirely image tests. The developer notes explain how to add image tests: http://matplotlib.org/devel/testing.html |
You learn something new everyday! Alright, thanks, will followup soon. |
@hugadams Did you ever get to adding image tests? |
Sorry, I never got around to finishing this. I've since lost the working Apologies On Fri, Jul 17, 2015 at 1:02 AM, Thomas A Caswell notifications@github.com
Adam Hughes |
Does this need anything apart from the test. I am happy to add the test if need be |
I think that's it On Fri, Jul 17, 2015 at 4:37 PM, Jens Hedegaard Nielsen <
Adam Hughes |
I would love to see this in v1.5. Just need a simple little test, and would also merit a "what's new" entry. |
Yes I will try to do the test over the weekend if no one else beats me to it |
I started working on a update here https://github.com/jenshnielsen/matplotlib/tree/nullstrideswireframe should be done tomorrow. |
Hey guys, Sorry to drop the ball on this, but thanks a lot of bringing it to On Sat, Aug 1, 2015 at 3:29 PM, Jens Hedegaard Nielsen <
Adam Hughes |
replaced by #4852 |
When making a wireframe plot, we've found that it's often nice to have just rowstrides or just column strides. Currently, a value of 0 for the stride distance will result in an error.
This small change seems all that is needed. Is there a reason for not wanting this to be allowed?
One issue I foresee is that if users pass rstride=None, cstride=None, they will get blank plot. I hope it would be obvious to them as to what is occurring in this case.
I've attached a screenshot of a wireframe plot with no column stride.
