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.
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 |
| 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.
Should this whole method be deprecated since it depends on csv2rec?
There was a problem hiding this comment.
Yes, and point people at pandas.
There was a problem hiding this comment.
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.plotfilecallsmlab.csv2rev, which is deprecated. Because that function provides some automatic converters, I could not replace it withnp.genfromtxtornp.loadtxtright away, as that would be a behaviour change. Even the examples take advantage of this behaviour.plt.plotfilealso triggers a warning about re-using anAxesspec. I have not looked too deeply into fixing that one.PR Checklist