Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

hughesadam87
Copy link
Contributor

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.
no_stride_plot

@@ -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:
Copy link
Member

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?

@hughesadam87
Copy link
Contributor Author

Doh. See now, sorry

@WeatherGod
Copy link
Member

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.

@hughesadam87
Copy link
Contributor Author

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.

@WeatherGod
Copy link
Member

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

@hughesadam87
Copy link
Contributor Author

You learn something new everyday! Alright, thanks, will followup soon.

@tacaswell tacaswell modified the milestones: proposed next point release, next point release Feb 19, 2015
@tacaswell
Copy link
Member

@hugadams Did you ever get to adding image tests?

@tacaswell tacaswell modified the milestones: proposed next point release, next point release Jul 17, 2015
@hughesadam87
Copy link
Contributor Author

Sorry, I never got around to finishing this. I've since lost the working
environment, and realistically don't have time right now to followup. If
you want to close the PR, no prob.

Apologies

On Fri, Jul 17, 2015 at 1:02 AM, Thomas A Caswell notifications@github.com
wrote:

@hugadams https://github.com/hugadams Did you ever get to adding image
tests?


Reply to this email directly or view it on GitHub
#3554 (comment)
.

Adam Hughes
Physics Ph.D Candidate
George Washington University

@jenshnielsen
Copy link
Member

Does this need anything apart from the test. I am happy to add the test if need be

@hughesadam87
Copy link
Contributor Author

I think that's it

On Fri, Jul 17, 2015 at 4:37 PM, Jens Hedegaard Nielsen <
notifications@github.com> wrote:

Does this need anything apart from the test. I am happy to add the test if
need be


Reply to this email directly or view it on GitHub
#3554 (comment)
.

Adam Hughes
Physics Ph.D Candidate
George Washington University

@jenshnielsen jenshnielsen self-assigned this Jul 18, 2015
@WeatherGod
Copy link
Member

I would love to see this in v1.5. Just need a simple little test, and would also merit a "what's new" entry.

@jenshnielsen
Copy link
Member

Yes I will try to do the test over the weekend if no one else beats me to it

@jenshnielsen
Copy link
Member

I started working on a update here https://github.com/jenshnielsen/matplotlib/tree/nullstrideswireframe should be done tomorrow.

@hughesadam87
Copy link
Contributor Author

Hey guys,

Sorry to drop the ball on this, but thanks a lot of bringing it to
completion.

On Sat, Aug 1, 2015 at 3:29 PM, Jens Hedegaard Nielsen <
notifications@github.com> wrote:

I started working on a update here
https://github.com/jenshnielsen/matplotlib/tree/nullstrideswireframe
should be done tomorrow.


Reply to this email directly or view it on GitHub
#3554 (comment)
.

Adam Hughes
Physics Ph.D Candidate
George Washington University

@jenshnielsen
Copy link
Member

replaced by #4852

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants