Compute secondary axis min max and label positions
774834
def _compute_secondary(self):
        """"""
        # secondary y axis support
        if self.secondary_series and self._y_labels:
            y_pos = list(zip(*self._y_labels))[1]
            if self.include_x_axis:
                ymin = min(self._secondary_min, 0)
                ymax = max(self._secondary_max, 0)
            else:
                ymin = self._secondary_min
                ymax = self._secondary_max
            steps = len(y_pos)
            left_range = abs(y_pos[-1] - y_pos[0])
            right_range = abs(ymax - ymin) or 1
            scale = right_range / ((steps - 1) or 1)
            self._y_2nd_labels = [(self._y_format(ymin + i * scale), pos)
                                  for i, pos in enumerate(y_pos)]

            self._scale = left_range / right_range
            self._scale_diff = y_pos[0]
            self._scale_min_2nd = ymin
872580
def _post_compute(self):
        """"""
        self._x_labels, self._y_labels = self._y_labels, self._x_labels
        self._x_labels_major, self._y_labels_major = (
            self._y_labels_major, self._x_labels_major
        )
        self._x_2nd_labels, self._y_2nd_labels = (
            self._y_2nd_labels, self._x_2nd_labels
        )
        self.show_y_guides, self.show_x_guides = (
            self.show_x_guides, self.show_y_guides
        )
665545
def D(self):
        '''
        
        '''
        return Point(self.minX, self.maxY, self.origin.z)
850026
def yAxisIsMinor(self):
        '''
        
        '''
        return min(self.radius.x, self.radius.y) == self.radius.y
344786
def argmin(self, axis=None, skipna=True, *args, **kwargs):
        
        nv.validate_argmin(args, kwargs)
        nv.validate_minmax_axis(axis)

        i8 = self.asi8
        if self.hasnans:
            mask = self._isnan
            if mask.all() or not skipna:
                return -1
            i8 = i8.copy()
            i8[mask] = np.iinfo('int64').max
        return i8.argmin()
751318
def apply_default_labels(self, other):
        
        other_updated = other.copy()
        other_updated.units_label = self.units_label
        other_updated.name_label = self.name_label
        other_updated.notes_label = self.notes_label
        other_updated.desc_label = self.desc_label
        other_updated.plot_label = self.plot_label
        other_updated.axis_label = self.axis_label
        other_updated.scale_label = self.scale_label
        other_updated.min_label = self.min_label
        other_updated.max_label = self.max_label
        other_updated.fill_label = self.fill_label
        return other
291092
def _get_axis_label(self, dim):
        """"""
        if u(dim[:-1]).isdecimal():
            n = len(self.channel_ids)
            return str(self.channel_ids[int(dim[:-1]) % n]) + dim[-1]
        else:
            return dim
361462
def axis_bounds(self) -> Dict[str, Tuple[float, float]]:
        
        return {ax: (0, pos+0.5) for ax, pos in _HOME_POSITION.items()
                if ax not in 'BC'}
958507
def calc_size(rect, orientation):
        
        (total_halfx, total_halfy) = rect.center
        if orientation in ["bottom", "top"]:
            (total_major_axis, total_minor_axis) = (total_halfx, total_halfy)
        else:
            (total_major_axis, total_minor_axis) = (total_halfy, total_halfx)

        major_axis = total_major_axis * (1.0 -
                                         ColorBarWidget.major_axis_padding)
        minor_axis = major_axis * ColorBarWidget.minor_axis_ratio

        # if the minor axis is "leaking" from the padding, then clamp
        minor_axis = np.minimum(minor_axis,
                                total_minor_axis *
                                (1.0 - ColorBarWidget.minor_axis_padding))

        return (major_axis, minor_axis)
1180866
def max_min_projection(self, axis=2):
        
        if axis >= size(self.value_shape):
            raise Exception('Axis for projection (%s) exceeds '
                            'image dimensions (%s-%s)' % (axis, 0, size(self.value_shape)-1))

        new_value_shape = list(self.value_shape)
        del new_value_shape[axis]
        return self.map(lambda x: amax(x, axis) + amin(x, axis), value_shape=new_value_shape)
277087
def min(self):
        
        return self._constructor(self.values.min(axis=self.baseaxes, keepdims=True))
1270283
function (x, y, label, horiz, labelOptions, tickmarkOffset, index, step) {
            var axis = this.axis,
              transA = axis.transA,
              reversed = axis.reversed,
              staggerLines = axis.staggerLines;

            x = x + labelOptions.x - (tickmarkOffset && horiz ?
              tickmarkOffset * transA * (reversed ? -1 : 1) : 0);
            y = y + this.yOffset - (tickmarkOffset && !horiz ?
              tickmarkOffset * transA * (reversed ? 1 : -1) : 0);

            // Correct for staggered labels
            if (staggerLines) {
                label.line = (index / (step || 1) % staggerLines);
                y += label.line * (axis.labelOffset / staggerLines);
            }

            return {
                x: x,
                y: y
            };
        }
973002
def get_axis_properties(axis):
    """"""
    props = {}
    label1On = axis._major_tick_kw.get('label1On', True)

    if isinstance(axis, matplotlib.axis.XAxis):
        if label1On:
            props['position'] = "bottom"
        else:
            props['position'] = "top"
    elif isinstance(axis, matplotlib.axis.YAxis):
        if label1On:
            props['position'] = "left"
        else:
            props['position'] = "right"
    else:
        raise ValueError("{0} should be an Axis instance".format(axis))

    # Use tick values if appropriate
    locator = axis.get_major_locator()
    props['nticks'] = len(locator())
    if isinstance(locator, ticker.FixedLocator):
        props['tickvalues'] = list(locator())
    else:
        props['tickvalues'] = None

    # Find tick formats
    formatter = axis.get_major_formatter()
    if isinstance(formatter, ticker.NullFormatter):
        props['tickformat'] = ""
    elif isinstance(formatter, ticker.FixedFormatter):
        props['tickformat'] = list(formatter.seq)
    elif not any(label.get_visible() for label in axis.get_ticklabels()):
        props['tickformat'] = ""
    else:
        props['tickformat'] = None

    # Get axis scale
    props['scale'] = axis.get_scale()

    # Get major tick label size (assumes that's all we really care about!)
    labels = axis.get_ticklabels()
    if labels:
        props['fontsize'] = labels[0].get_fontsize()
    else:
        props['fontsize'] = None

    # Get associated grid
    props['grid'] = get_grid_style(axis)

    return props
1056247
function (plot, axis, noTicks) {
        var ticks = [],
            minIdx = -1,
            maxIdx = -1,
            surface = plot.getCanvas(),
            logTickValues = PREFERRED_LOG_TICK_VALUES,
            min = clampAxis(axis, plot),
            max = axis.max;

        if (!noTicks) {
            noTicks = 0.3 * Math.sqrt(axis.direction === "x" ? surface.width : surface.height);
        }

        PREFERRED_LOG_TICK_VALUES.some(function (val, i) {
            if (val >= min) {
                minIdx = i;
                return true;
            } else {
                return false;
            }
        });

        PREFERRED_LOG_TICK_VALUES.some(function (val, i) {
            if (val >= max) {
                maxIdx = i;
                return true;
            } else {
                return false;
            }
        });

        if (maxIdx === -1) {
            maxIdx = PREFERRED_LOG_TICK_VALUES.length - 1;
        }

        if (maxIdx - minIdx <= noTicks / 4 && logTickValues.length !== EXTENDED_LOG_TICK_VALUES.length) {
            //try with multiple of 5 for tick values
            logTickValues = EXTENDED_LOG_TICK_VALUES;
            minIdx *= 2;
            maxIdx *= 2;
        }

        var lastDisplayed = null,
            inverseNoTicks = 1 / noTicks,
            tickValue, pixelCoord, tick;

        // Count the number of tick values would appear, if we can get at least
        // nTicks / 4 accept them.
        if (maxIdx - minIdx >= noTicks / 4) {
            for (var idx = maxIdx; idx >= minIdx; idx--) {
                tickValue = logTickValues[idx];
                pixelCoord = (Math.log(tickValue) - Math.log(min)) / (Math.log(max) - Math.log(min));
                tick = tickValue;

                if (lastDisplayed === null) {
                    lastDisplayed = {
                        pixelCoord: pixelCoord,
                        idealPixelCoord: pixelCoord
                    };
                } else {
                    if (Math.abs(pixelCoord - lastDisplayed.pixelCoord) >= inverseNoTicks) {
                        lastDisplayed = {
                            pixelCoord: pixelCoord,
                            idealPixelCoord: lastDisplayed.idealPixelCoord - inverseNoTicks
                        };
                    } else {
                        tick = null;
                    }
                }

                if (tick) {
                    ticks.push(tick);
                }
            }
            // Since we went in backwards order.
            ticks.reverse();
        } else {
            var tickSize = plot.computeTickSize(min, max, noTicks),
                customAxis = {min: min, max: max, tickSize: tickSize};
            ticks = $.plot.linearTickGenerator(customAxis);
        }

        return ticks;
    }
546055
def min(x, y, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_min,
        (
            BigFloat._implicit_convert(x),
            BigFloat._implicit_convert(y),
        ),
        context,
    )
363082
def validate_minmax_axis(axis):
    
    ndim = 1  # hard-coded for Index
    if axis is None:
        return
    if axis >= ndim or (axis < 0 and ndim + axis < 0):
        raise ValueError("`axis` must be fewer than the number of "
                         "dimensions ({ndim})".format(ndim=ndim))
542195
def classify_nearest(self, partial_labels):
    '''
    '''
    labels = np.array(partial_labels, copy=True)
    unlabeled = labels == -1
    # compute geodesic distances from unlabeled vertices
    D_unlabeled = self.shortest_path(weighted=True)[unlabeled]
    # set distances to other unlabeled vertices to infinity
    D_unlabeled[:,unlabeled] = np.inf
    # find shortest distances to labeled vertices
    idx = D_unlabeled.argmin(axis=1)
    # apply the label of the closest vertex
    labels[unlabeled] = labels[idx]
    return labels