You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I read the PR, but was not clear to me why the functionality was not deemed important. What I want is for the axis to span only the region where the datapoints are.
No, that is not what I meant. What I mean is e.g. if I set the limits of the y-axis to span [0-100] but my data spans [20-100], then the left spine would by drawn starting from 20 up to 100. But there will be an empty space from 0 to 20 (no line would be drawn).
I think the feature was deemed a bit strange to merit the amount of code and maintenance involved. But if you can make a strong case for it being useful folks may change their minds. (ping @efiring)
Well, I don't have strong sentiments attached to the function (although I have used it a lot in the past couple of years), but I think the functionality is nice. I read in Tufte's book [1] about the concept of "double-functioning labels", where the idea is to mark the range of your data with the spine. In the details it is not exactly as what set_smart_bounds() does, but quite similar. However, I guess that using spine.set_bounds(x.min(), x.max()) is also a viable solution.
[1] Tufte, Edward R. (1986). "The Visual Display of Quantitative Information", Graphics Press, Cheshire, CT, USA
In the case where it is relevant to have the zero as well. If I am showing some ratios it helps to have the full range from zero, so that the magnitude is correctly interpreted.
The first one is what I described above, where I have some ratios and it is important to know where zero is (so that large variations actually mean large variations and not just that we are in a different scale). I think is nice sometimes to just mark the range this way.
The other way I use it is in normal plots, where I just like the effect of the spines to be separated, like this:
Maybe in the first example (as pointed out by @jklymak) it would be better to also mark the zero in the y-axis. But those are my main uses for the function.
Yes, it would. The set_smart_bounds() is (as I see it) only a shortcut, especially useful when more than one data set is plotted (then the maximum and minimum of all the plotted data has to be considered).
Activity
jklymak commentedon Oct 14, 2019
What effect are you trying to achieve. This was relatively robustly discussed in the PR. You can look up the issue using the search function
cristobaltapia commentedon Oct 14, 2019
I read the PR, but was not clear to me why the functionality was not deemed important. What I want is for the axis to span only the region where the datapoints are.
jklymak commentedon Oct 14, 2019
ax.margins(0)does that, I think?cristobaltapia commentedon Oct 14, 2019
No, that is not what I meant. What I mean is e.g. if I set the limits of the y-axis to span [0-100] but my data spans [20-100], then the left spine would by drawn starting from 20 up to 100. But there will be an empty space from 0 to 20 (no line would be drawn).
jklymak commentedon Oct 14, 2019
spine.set_bounds(x.min(), x.max())? https://matplotlib.org/3.1.1/api/spines_api.html#matplotlib.spines.Spine.set_boundsI think the feature was deemed a bit strange to merit the amount of code and maintenance involved. But if you can make a strong case for it being useful folks may change their minds. (ping @efiring)
tacaswell commentedon Oct 14, 2019
xref #11004
cristobaltapia commentedon Oct 14, 2019
Well, I don't have strong sentiments attached to the function (although I have used it a lot in the past couple of years), but I think the functionality is nice. I read in Tufte's book [1] about the concept of "double-functioning labels", where the idea is to mark the range of your data with the spine. In the details it is not exactly as what
set_smart_bounds()does, but quite similar. However, I guess that usingspine.set_bounds(x.min(), x.max())is also a viable solution.[1] Tufte, Edward R. (1986). "The Visual Display of Quantitative Information", Graphics Press, Cheshire, CT, USA
jklymak commentedon Oct 14, 2019
Sure, but why wouldn't you just set the xlim to
[20, 100]and not have the blank space?cristobaltapia commentedon Oct 14, 2019
In the case where it is relevant to have the zero as well. If I am showing some ratios it helps to have the full range from zero, so that the magnitude is correctly interpreted.
jklymak commentedon Oct 14, 2019
How does the viewer know zero is there somewhere? Maybe you could show an example?
tacaswell commentedon Oct 14, 2019
One of the hardest things for us to know is what parts of the library are actually used. It is good to know this feature actually has users :)
I think the question is how are you using it and how onerous the alternatives are?
cristobaltapia commentedon Oct 15, 2019
Here are some examples:
The first one is what I described above, where I have some ratios and it is important to know where zero is (so that large variations actually mean large variations and not just that we are in a different scale). I think is nice sometimes to just mark the range this way.
The other way I use it is in normal plots, where I just like the effect of the spines to be separated, like this:
Maybe in the first example (as pointed out by @jklymak) it would be better to also mark the zero in the y-axis. But those are my main uses for the function.
jklymak commentedon Oct 15, 2019
Seems those would both work w/
set_bounds?cristobaltapia commentedon Oct 21, 2019
Yes, it would. The
set_smart_bounds()is (as I see it) only a shortcut, especially useful when more than one data set is plotted (then the maximum and minimum of all the plotted data has to be considered).efiring commentedon Oct 22, 2019
Given that
set_boundsseems adequate for the use cases, and has the advantage of being clear and explicit, I think this can be closed.