QInfer / python-qinfer

Library for Bayesian inference via sequential Monte Carlo for quantum parameter estimation.
BSD 3-Clause "New" or "Revised" License
92 stars 31 forks source link

Switch from `color_cycle` to `prop_cycle` in tomography plotting tools #150

Open ihincks opened 5 years ago

ihincks commented 5 years ago

This was a name change in matplotlib 1.5 of the default color cycle, and the old name is now deprecated.

This PR addresses https://github.com/QInfer/qinfer-examples/issues/4#issue-407817702

scasagrande commented 5 years ago

This matplotlib>=1.5 requirement should be listed somewhere in the project. A good place might be under optional requirements in setup.py

ihincks commented 5 years ago

Hmm, it's not actually a requirement; it's imported in try blocks. Maybe we should check the version inside the try block and raise if < 1.5.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 75.631% when pulling 397c98be54e592df893c5963ff87b59200d2bb04 on fix-color_cycle into 8170c84a0be1723f8c6b09e0d3c7a40a886f1fe3 on master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 75.631% when pulling 397c98be54e592df893c5963ff87b59200d2bb04 on fix-color_cycle into 8170c84a0be1723f8c6b09e0d3c7a40a886f1fe3 on master.

scasagrande commented 5 years ago

Right, but matplotlib is an optional requirement and can be listed as such.

I also imagine it should be listed in the docs somewhere.

Actually, checking just now the matplotlib website, 2.2.x is the LTS dual py2/3 release. It appears that 1.5 was the last 1.x release, which is no longer supported. I'd probably still put a check in somewhere, but you might not need to put it in the docs.

scasagrande commented 5 years ago

I checked travis, its reporting failures on doctest for both 2.7 and 3.5

3.5: Could not import extension matplotlib.sphinxext.only_directives, which was apparently removed in matplotlib 3 https://github.com/matplotlib/matplotlib/pull/11295

2.7: ImportError: cannot import name l_ caused at conf.py#L18

mikedeltalima commented 4 years ago

I tried this, but the cycler can't be indexed

line 177, in plot_rebit_prior
    c=pallette[0],
ValueError: Can only use slices with Cycler.__getitem__

Maybe something like pallette = [x['color'] for x in plt.rcParams['axes.prop_cycle']] instead?