-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix deprecations in examples #10385
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
Fix deprecations in examples #10385
Conversation
The normal colorbar works fine if calling colorbar.set_ticks instead of colobar.ax.set_ticks, which is noted in the deprecation warning. There is no real benefit of showing the axes_grid1 version now.
Unfortunately, csv2rec provides some automatic converters, so it can't be replaced entirely with np.genfromtxt or np.loadtxt.
There are also a few warnings about |
62a7788
to
c4197df
Compare
datafile = cbook.get_sample_data('msft.csv', asfileobj=False) | ||
print('loading %s' % datafile) | ||
r = csv2rec(datafile)[-40:] | ||
r = np.genfromtxt(datafile, delimiter=',', names=True, |
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.
Maybe use a more telling name like msft_data
instead of r
?
Oh, hmmm, that should give a warning, but for constrained layout, not tight layout! Ooops..
|
@jklymak Actually, I was referring to the examples, not the tests. For example,
|
c4197df
to
5193922
Compare
The last one is mine, and on purpose to show the failure in the tutorial. The |
@@ -2411,8 +2411,11 @@ def plotfile(fname, cols=(0,), plotfuncs=None, | |||
|
|||
if plotfuncs is None: | |||
plotfuncs = dict() | |||
r = mlab.csv2rec(fname, comments=comments, skiprows=skiprows, | |||
checkrows=checkrows, delimiter=delimiter, names=names) | |||
from matplotlib.cbook import mplDeprecation |
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.
Should this whole method be deprecated since it depends on csv2rec
?
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.
Yes, and point people at pandas.
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.
You want to deprecate plt.plotfile
for Pandas? Probably should be an independent PR.
PR Summary
This fixes several deprecation warnings that are triggered by the examples.
Currently,
plt.plotfile
callsmlab.csv2rev
, which is deprecated. Because that function provides some automatic converters, I could not replace it withnp.genfromtxt
ornp.loadtxt
right away, as that would be a behaviour change. Even the examples take advantage of this behaviour.plt.plotfile
also triggers a warning about re-using anAxes
spec. I have not looked too deeply into fixing that one.PR Checklist