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
[feature request] Accepting slice
arguments in ax.set_xlim()
(Python 3)
#8349
Comments
slice objects have always been around in Python and if we go this route, both formal slice objects and index slicing of the df[a:b] variety should probably be supported. |
The request is to just take the start / stop values from the slice, not to try to slice into anything right? This seems like it would cause confusion with x = range(100, 200)
fig, ax = plt.subplots()
ax.plot(x, x)
ax.set_xlim(slice(10, 50)) as people might expect that we would pick the range slicing into the data of one of the artists. This should be easy enough to implement (the From the example this really only makes sense when working with slices into non-trivial panads dataframes/series? I expect it to be nice with xarray as well? If we do this, exact work:
|
FWIW I am against the proposal.
|
Are we going ahead with this request? If yes, Can I work on it? |
I am still voting no. |
I am strongly opposed. As far as I can see, this API change adds complexity and confusion, with no real gain. |
I am ambivalent to negative and there are 2 other 👎 so closing this as wont-fix, sorry. |
Bug report
Bug summary
ax.set_xlim()
accepts accepts a tuple as argument for setting the limit of the X axis;slice
type which is used for reprenting a slice and is used forx[2:3]
slicing;Series
/DataFrame
:df[begin:end]
ordf[get_range(params)]
;slice
argument instead of a tuple inax.set_xlim()
for consistency/easability.Code for reproduction
Actual outcome
Expected outcome
I'd expect
ax.set_xlim(slice(a, b))
to behave asax.set_xlim((a,b))
.Matplotlib version
Using
matplotlib (2.0.0)
installed throughpip
.The text was updated successfully, but these errors were encountered: