|
646 | 646 | The minimum and maximum marker size area in units ``points ** 2``. Ignored |
647 | 647 | if `absolute_size` is ``True``. Default value for `smin` is ``1`` and for |
648 | 648 | `smax` is the square of :rc:`lines.markersize`. |
| 649 | +area_size : bool, default: True |
| 650 | + Whether the marker sizes `s` are scaled by area or by radius. The default |
| 651 | + ``True`` is consistent with matplotlib. When `absolute_size` is ``True``, |
| 652 | + the `s` units are ``points ** 2`` if `area_size` is ``True`` and ``points`` |
| 653 | + if `area_size` is ``False``. |
649 | 654 | absolute_size : bool, default: True or False |
650 | | - Whether `s` should be taken to represent "absolute" marker size areas in units |
651 | | - ``points ** 2`` or "relative" marker size areas scaled by `smin` and `smax`. |
652 | | - Default is ``True`` if `s` is scalar and ``False`` if `s` is array-like. |
| 655 | + Whether `s` should be taken to represent "absolute" marker sizes in units |
| 656 | + ``points`` or ``points ** 2`` or "relative" marker sizes scaled by `smin` |
| 657 | + and `smax`. Default is ``True`` if `s` is scalar and ``False`` if `s` is |
| 658 | + array-like or `smin` or `smax` were passed. |
653 | 659 | %(plot.vmin_vmax)s |
654 | 660 | %(plot.args_1d_shared)s |
655 | 661 |
|
@@ -1658,10 +1664,10 @@ def _fix_patch_edges(obj, edgefix=None, **kwargs): |
1658 | 1664 | with colormaps that are transparent. If keyword args passed by user |
1659 | 1665 | include explicit edge properties then we skip this step. |
1660 | 1666 | """ |
| 1667 | + # NOTE: Use default edge width used for pcolor grid box edges. This is thick |
| 1668 | + # enough to hide lines but thin enough to not add 'nubs' to corners of boxes. |
1661 | 1669 | # See: https://github.com/jklymak/contourfIssues |
1662 | 1670 | # See: https://stackoverflow.com/q/15003353/4970632 |
1663 | | - # NOTE: Use default edge width used for pcolor grid box edges. This is thick |
1664 | | - # enough to hide lines but thin enough to not add 'dots' to corners of boxes. |
1665 | 1671 | edgefix = _not_none(edgefix, rc.edgefix, True) |
1666 | 1672 | linewidth = EDGEWIDTH if edgefix is True else 0 if edgefix is False else edgefix |
1667 | 1673 | if not linewidth: |
@@ -3152,32 +3158,22 @@ def hlines(self, *args, **kwargs): |
3152 | 3158 | return self._apply_lines(*args, **kwargs) |
3153 | 3159 |
|
3154 | 3160 | def _parse_markersize( |
3155 | | - self, s, *, smin=None, smax=None, absolute_size=None, **kwargs |
| 3161 | + self, s, *, smin=None, smax=None, area_size=True, absolute_size=None, **kwargs |
3156 | 3162 | ): |
3157 | 3163 | """ |
3158 | 3164 | Scale the marker sizes with optional keyword args. |
3159 | 3165 | """ |
3160 | | - default_size = True |
3161 | | - if np.iterable(s): |
3162 | | - s = np.asarray(s) |
3163 | | - if not inputs._is_categorical(s): |
3164 | | - default_size = False |
3165 | | - else: |
3166 | | - s = s.copy() |
3167 | | - s.flat[:] = utils.units(s.flat, 'pt') |
3168 | | - s = s.astype(np.float64) ** 2 |
3169 | | - if absolute_size is None: |
3170 | | - if _inside_seaborn_call(): |
3171 | | - absolute_size = True |
3172 | | - else: |
3173 | | - absolute_size = default_size |
3174 | | - if not absolute_size or smin is not None or smax is not None: |
3175 | | - smin = _not_none(smin, 1) |
3176 | | - smax = _not_none(smax, rc['lines.markersize'] ** 2) |
3177 | | - smin_true, smax_true = inputs._safe_range(s) |
3178 | | - smin_true = _not_none(smin_true, smin) # fallback behavior |
3179 | | - smax_true = _not_none(smax_true, smax) |
3180 | | - s = smin + (smax - smin) * (s - smin_true) / (smax_true - smin_true) |
| 3166 | + if s is not None: |
| 3167 | + s = inputs._to_numpy_array(s) |
| 3168 | + if absolute_size is None: |
| 3169 | + absolute_size = s.size == 1 or _inside_seaborn_call() |
| 3170 | + if not absolute_size or smin is not None or smax is not None: |
| 3171 | + smin = _not_none(smin, 1) |
| 3172 | + smax = _not_none(smax, rc['lines.markersize'] ** (1, 2)[area_size]) |
| 3173 | + dmin, dmax = inputs._safe_range(s) # data value range |
| 3174 | + if dmin is not None and dmax is not None and dmin != dmax: |
| 3175 | + s = smin + (smax - smin) * (s - dmin) / (dmax - dmin) |
| 3176 | + s = s ** (2, 1)[area_size] |
3181 | 3177 | return s, kwargs |
3182 | 3178 |
|
3183 | 3179 | def _apply_scatter(self, xs, ys, ss, cc, *, vert=True, **kwargs): |
|
0 commit comments