Skip to content

Added rcount/ccount to plot_surface() #7164

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

Merged
merged 1 commit into from
Dec 13, 2016

Conversation

WeatherGod
Copy link
Member

... providing an alternative to rstride/cstride

Still needs a whats_new.rst entry.

@tacaswell tacaswell added this to the 2.0 (style change major release) milestone Sep 22, 2016
@tacaswell
Copy link
Member

Slightly concerned about making the API too complicated.

@anntzer
Copy link
Contributor

anntzer commented Sep 22, 2016

Perhaps better as a single "max_gridsize" kwarg?

@WeatherGod
Copy link
Member Author

WeatherGod commented Sep 23, 2016

Here is my rationale for my API decision. The rest of the plot_surface() method is highly dependent upon rstride/cstride. It would be a significant amount of work to refactor that to take something more general, and yield very little gain. So, if rstride/cstride are still going to be the critical pieces of information within the method, then it makes no sense to deprecate them as inputs... so they stay.

Next, I dislike the idea of overloading the current rstride/cstride arguments, which has been suggested by others. The names of the arguments have very specific and clear meaning, and so they would be difficult to conceptually overload. Besides, what would I overload it with? String representation of ints? That would be awkward and tedious.

So, that means that not only are rstride/cstride are going to stay, but that new arguments will be needed for any new specification. Given the orthogonality of rstride/cstride, it makes sense that the new arguments would also be orthogonal (so, have two arguments instead of just one). It also makes it simple for managing precedence if both or neither the stride and the new argument are specified.

So, all that is left is the nature of the new arguments. I like my choice of "maximum count" instead of "exact count" because I can't guarantee that the array could be split into that many equally spaced pieces. Remember, I still have to plug into the cstride/rstride usage internally, so the samples must be equally spaced.

So, now the user is free to use either a stride or a count, which is conceptually similar to arange() vs. linspace() (granted, the max count idea doesn't fit perfectly with linspace). Depending on their situation, they are free to choose whichever approach that best suits them.

I am not entirely sold on the need to apply a "classic mode" as fully as I do here. I could be convinced to only apply it if neither stride nor count is given.

rstride = kwargs.pop('rstride', 10)
cstride = kwargs.pop('cstride', 10)
rcount = kwargs.pop('rcount', 50)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slight preference to raise if both count and stride are provided.

@tacaswell
Copy link
Member

@WeatherGod I am convinced and am ok with this going in as-is. Slight preference for raising if both stride and count are given which would make it a bit easier to document and no need to have the classic compatibility mode.

@dopplershift
Copy link
Contributor

I agree that passing both flags is an error which shouldn't pass silently.

@WeatherGod
Copy link
Member Author

Agreed. I'll see if I can find time tonight to fix that.

On Mon, Oct 3, 2016 at 3:30 PM, Ryan May notifications@github.com wrote:

I agree that passing both flags is an error which shouldn't pass silently.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7164 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-CRrdv8BDB7nvgr50pIvbBahQEAUks5qwVfQgaJpZM4KEX1M
.

@QuLogic
Copy link
Member

QuLogic commented Oct 25, 2016

Needs a rebase now.

@WeatherGod WeatherGod force-pushed the mplot3d/surface_strides branch from ee782b1 to 2f75b39 Compare November 10, 2016 16:32
@WeatherGod
Copy link
Member Author

WeatherGod commented Nov 10, 2016

Just realized something... I should add this feature to plot_wireframe(), too, right?

@WeatherGod
Copy link
Member Author

Of course, the question then becomes: if we do add it to plot_wireframe(), then should rcount/ccount be the default samplers, or should it remain rstride/cstride (which currently defaults to 1, unlike plot_surface())?

@tacaswell
Copy link
Member

I am 👍 on adding it to plot_wireframe if we can get it done in time. That should not hold this PR.

Failures look real and related to this PR.

@WeatherGod
Copy link
Member Author

Yes, I forgot to update the tests when I made it such that you can't
specify both counts and strides. I have that fix in queue. I am just trying
to figure out what is desired for plot_wireframe() because it is similar,
but not the same as plot_surface()'s argument handling.

On Thu, Nov 10, 2016 at 10:03 PM, Thomas A Caswell <notifications@github.com

wrote:

I am 👍 on adding it to plot_wireframe if we can get it done in time.
That should not hold this PR.

Failures look real and related to this PR.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7164 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-DTB94imZ71-tOMO4As3p6Pj224Hks5q89sRgaJpZM4KEX1M
.

@tacaswell
Copy link
Member

bump @WeatherGod

@WeatherGod WeatherGod force-pushed the mplot3d/surface_strides branch from 9c9b72f to f124032 Compare December 6, 2016 03:19
if both stride and count are used.

` The `rcount` and `ccount` kwargs supersedes `rstride` and
`cstride`for default sampling method for wireframe plotting.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after backtick causing problem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, maybe

(see next section) are provided.

The `rcount` and `ccount` kwargs supersedes `rstride` and
`cstride`for default sampling method for surface plotting.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after backtick.

@QuLogic
Copy link
Member

QuLogic commented Dec 6, 2016

The single backticks should be double backticks in many cases; they aren't references, but code.

@WeatherGod
Copy link
Member Author

Perhaps, but that'll be more suited for a different PR. Right now, I am just following the current conventions in this file.

@tacaswell
Copy link
Member

@WeatherGod Why did you regenerate the pdf and svg test images?

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modulo removing the regeneration of the 4 test images.

Copy link
Contributor

@dopplershift dopplershift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look fine to me. Curious about the need to regenerate the images, since they seem to be visually identical (at least the SVGs).

@WeatherGod
Copy link
Member Author

WeatherGod commented Dec 12, 2016 via email

@WeatherGod WeatherGod force-pushed the mplot3d/surface_strides branch from efa3ec9 to 58d3de2 Compare December 13, 2016 01:29
@WeatherGod
Copy link
Member Author

yeah, looks like those images were accidentally regenerated. I brought back what was in master for them and re-ran my tests and they passed. So I committed those images back in, and then did a squash commit to eliminate the change out of the history. The tests should be done shortly.

@tacaswell tacaswell merged commit 16e3b9a into matplotlib:v2.x Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants