Skip to content
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

Compatibility Issue with MatplotLib 1.5.3 #9

Closed
bhorowitz opened this issue Nov 1, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@bhorowitz
Copy link

commented Nov 1, 2016

I recently updated my matplotlib version to 1.5.3 and a few old notebooks that had 2dplots that were working now return the error:

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/getdist/plots.pyc in add_2d_contours(self, root, param1, param2, plotno, of, cols, contour_levels, add_legend_proxy, param_pair, density, alpha, ax, **kwargs)
    906             kwargs['alpha'] = alpha
    907             CS = ax.contour(density.x, density.y, density.P, contour_levels, colors=cols, linestyles=linestyles,
--> 908                             linewidths=self.settings.lw_contour, **kwargs)
    909             dashes = args.get('dashes')
    910             if dashes:

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
   1817                     warnings.warn(msg % (label_namer, func.__name__),
   1818                                   RuntimeWarning, stacklevel=2)
-> 1819             return func(ax, *args, **kwargs)
   1820         pre_doc = inner.__doc__
   1821         if pre_doc is None:

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in contour(self, *args, **kwargs)
   5617             self.cla()
   5618         kwargs['filled'] = False
-> 5619         return mcontour.QuadContourSet(self, *args, **kwargs)
   5620     contour.__doc__ = mcontour.QuadContourSet.contour_doc
   5621 

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/matplotlib/contour.pyc in __init__(self, ax, *args, **kwargs)
   1422         are described in QuadContourSet.contour_doc.
   1423         """
-> 1424         ContourSet.__init__(self, ax, *args, **kwargs)
   1425 
   1426     def _process_args(self, *args, **kwargs):

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/matplotlib/contour.pyc in __init__(self, ax, *args, **kwargs)
    861         self._transform = kwargs.get('transform', None)
    862 
--> 863         self._process_args(*args, **kwargs)
    864         self._process_levels()
    865 

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/matplotlib/contour.pyc in _process_args(self, *args, **kwargs)
   1443                 self._corner_mask = mpl.rcParams['contour.corner_mask']
   1444 
-> 1445             x, y, z = self._contour_args(args, kwargs)
   1446 
   1447             _mask = ma.getmask(z)

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/matplotlib/contour.pyc in _contour_args(self, args, kwargs)
   1538             warnings.warn('Log scale: values of z <= 0 have been masked')
   1539             self.zmin = float(z.min())
-> 1540         self._contour_level_args(z, args)
   1541         return (x, y, z)
   1542 

/Users/bhorowitz/virtual/_notebook/lib/python2.7/site-packages/matplotlib/contour.pyc in _contour_level_args(self, z, args)
   1187                 warnings.warn("Contour levels are not increasing")
   1188             else:
-> 1189                 raise ValueError("Contour levels must be increasing")
   1190 
   1191     def _process_levels(self):

ValueError: Contour levels must be increasing
@bhorowitz

This comment has been minimized.

Copy link
Author

commented Nov 1, 2016

Seems related to this fix in corner.py: dfm/corner.py#70

@cmbant

This comment has been minimized.

Copy link
Owner

commented Nov 1, 2016

Commit 225d488 fixed something similar, are you using the latest github version of getdist?

@cmbant

This comment has been minimized.

Copy link
Owner

commented Nov 8, 2016

I've also now pushed v0.2.6 to pypi. Please confirm if still an issue.

@chc2259

This comment has been minimized.

Copy link

commented Nov 25, 2016

Does the latest version work?

If not, find the subroutine "Get2DPlotData" in file GetDist.f90,
change "write(numstr,) contour_levels(1:numcontours)" into "write(numstr,) contour_levels(numcontours:1:-1)"

Then it will work.

Good Luck!

@chc2259

This comment has been minimized.

Copy link

commented Nov 25, 2016

It seems the set-up of contour level in matlibplot is more strict.
So the order of level densities in file "yourfile_2D_p1_p2_cont" must be increasing.
And also you can just sort these numbers in the ascending order.

@cmbant

This comment has been minimized.

Copy link
Owner

commented Nov 25, 2016

I didn't change the GetDist.f90 file, only the python version (which replaces the Fortran version).

@chc2259

This comment has been minimized.

Copy link

commented Nov 25, 2016

Oh, that's great! Thank you very much for the nice work.

[We still use the "old-fashioned" Fortran version, and it seems we need to keep abreast of time. : ) ]

@cmbant cmbant closed this Dec 31, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.