Skip to content

Commit 275bf30

Browse files
committed
Disable hexbin/hist/hist2d autoreverse (fix #334)
1 parent 9b98eff commit 275bf30

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

Diff for: WHATSNEW.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ Bug fixes
225225
arrays to plotting methods (:issue:`320`).
226226
* Fix issue where list-of-string colors passed to `~proplot.axes.Axes.scatter`
227227
are interpreted as data values (:issue:`316`).
228-
* Fix issue where settings passed to `~proplot.axes.Axes.colorbar` after e.g.
228+
* Fix issue where *x* and *y* axis limits are reversed when passing to
229+
`~matplotlib.axes.Axes.hexbin` and `~matplotlib.axes.Axes.hist2d` (:issue:`334`).
230+
* Fix regression where *x* or *y* axis limits are reversed when passing to
231+
`~matplotlib.axes.Axes.hist` and `~matplotlib.axes.Axes.histh` (:issue:`334`).
232+
* Fix issue where settings passed to `~proplot.axes.Axes.colorbar` after calling e.g.
229233
`~proplot.axes.PlotAxes.pcolor` with `colorbar_kw` are ignored (:issue:`314`).
230234
* Fix issues where passing the colorbar `orientation` without a `loc`, or using a non-
231235
standard `orientation` for a given `loc`, triggers tickloc error (:issue:`314`).

Diff for: proplot/axes/plot.py

+21-10
Original file line numberDiff line numberDiff line change
@@ -3010,7 +3010,9 @@ def parametric(self, x, y, c, *, interp=0, scalex=True, scaley=True, **kwargs):
30103010
kw.update(_pop_props(kw, 'collection'))
30113011
kw, extents = self._inbounds_extent(**kw)
30123012
label = _not_none(**{key: kw.pop(key, None) for key in ('label', 'value')})
3013-
x, y, kw = self._parse_1d_args(x, y, autovalues=True, autoreverse=False, values=c, **kw) # noqa: E501
3013+
x, y, kw = self._parse_1d_args(
3014+
x, y, values=c, autovalues=True, autoreverse=False, **kw
3015+
)
30143016
c = kw.pop('values', None) # permits auto-inferring values
30153017
c = np.arange(y.size) if c is None else inputs._to_numpy_array(c)
30163018
if (
@@ -3458,14 +3460,18 @@ def pie(self, x, explode, *, labelpad=None, labeldistance=None, **kwargs):
34583460
"""
34593461
kw = kwargs.copy()
34603462
pad = _not_none(labeldistance=labeldistance, labelpad=labelpad, default=1.15)
3461-
props = _pop_props(kw, 'patch')
3463+
wedge_kw = kw.pop('wedgeprops', None) or {}
3464+
wedge_kw.update(_pop_props(kw, 'patch'))
34623465
edgefix_kw = _pop_params(kw, self._fix_patch_edges)
3463-
_, x, kw = self._parse_1d_args(x, autox=False, autoy=False, **kw)
3466+
_, x, kw = self._parse_1d_args(
3467+
x, autox=False, autoy=False, autoreverse=False, **kw
3468+
)
34643469
kw = self._parse_cycle(x.size, **kw)
3465-
kw['labeldistance'] = pad
3466-
objs = self._call_native('pie', x, explode, wedgeprops=props, **kw)
3470+
objs = self._call_native(
3471+
'pie', x, explode, labeldistance=pad, wedgeprops=wedge_kw, **kw
3472+
)
34673473
objs = tuple(cbook.silent_list(type(seq[0]).__name__, seq) for seq in objs)
3468-
self._fix_patch_edges(objs[0], **edgefix_kw, **props)
3474+
self._fix_patch_edges(objs[0], **edgefix_kw, **wedge_kw)
34693475
return objs
34703476

34713477
@staticmethod
@@ -3735,7 +3741,9 @@ def _apply_hist(
37353741
# adds them to the first elements in the container for each column
37363742
# of the input data. Make sure that legend() will read both containers
37373743
# and individual items inside those containers.
3738-
_, xs, kw = self._parse_1d_args(xs, orientation=orientation, **kwargs)
3744+
_, xs, kw = self._parse_1d_args(
3745+
xs, autoreverse=False, orientation=orientation, **kwargs
3746+
)
37393747
fill = _not_none(fill=fill, filled=filled)
37403748
stack = _not_none(stack=stack, stacked=stacked)
37413749
if fill is not None:
@@ -3793,10 +3801,10 @@ def hist2d(self, x, y, bins, **kwargs):
37933801
"""
37943802
%(plot.hist2d)s
37953803
"""
3796-
# Rely on pcolormesh() override for this.
3804+
# Rely on the pcolormesh() override for this.
37973805
if bins is not None:
37983806
kwargs['bins'] = bins
3799-
return super().hist2d(x, y, default_discrete=False, **kwargs)
3807+
return super().hist2d(x, y, autoreverse=False, default_discrete=False, **kwargs)
38003808

38013809
# WARNING: breaking change from native 'C'
38023810
@inputs._preprocess_or_redirect('x', 'y', 'weights')
@@ -3809,7 +3817,10 @@ def hexbin(self, x, y, weights, **kwargs):
38093817
# WARNING: Cannot use automatic level generation here until counts are
38103818
# estimated. Inside _parse_level_vals if no manual levels were provided then
38113819
# _parse_level_num is skipped and args like levels=10 or locator=5 are ignored
3812-
x, y, kw = self._parse_1d_args(x, y, autovalues=True, **kwargs)
3820+
kw = kwargs.copy()
3821+
x, y, kw = self._parse_1d_args(
3822+
x, y, autoreverse=False, autovalues=True, **kw
3823+
)
38133824
kw.update(_pop_props(kw, 'collection')) # takes LineCollection props
38143825
kw = self._parse_cmap(x, y, y, skip_autolev=True, default_discrete=False, **kw)
38153826
norm = kw.get('norm', None)

0 commit comments

Comments
 (0)