Repository: matplotlib/matplotlib
File: lib/matplotlib/container.py (Python)

Code before:
    def tops(self):
        """
        Return the values at the upper end of the bars.

        .. versionadded:: 3.11
        """
        if self.orientation == 'vertical':
            return [p.get_y() + p.get_height() for p in self.patches]
        elif self.orientation == 'horizontal':
            return [p.get_x() + p.get_width() for p in self.patches]
        else:
            raise ValueError("Orientation must be 'vertical' or 'horizontal'.")

    @property
    def position_centers(self):
        """
        Return the centers of bar positions.

        .. versionadded:: 3.11
        """
        if self.orientation == 'vertical':
            return [p.get_x() + p.get_width() / 2 for p in self.patches]
        elif self.orientation == 'horizontal':
            return [p.get_y() + p.get_height() / 2 for p in self.patches]
        else:
            raise ValueError("Orientation must be 'vertical' or 'horizontal'.")


class ErrorbarContainer(Container):
    """
    Container for the artists of error bars (e.g. created by `.Axes.errorbar`).

    The container can be treated as the *lines* tuple itself.
    Additionally, you can access these and further parameters by the
    attributes.

    Attributes
    ----------
    lines : tuple
        Tuple of ``(data_line, caplines, barlinecols)``.

        - data_line : A `~matplotlib.lines.Line2D` instance of x, y plot markers
          and/or line.
        - caplines : A tuple of `~matplotlib.lines.Line2D` instances of the error
          bar caps.
        - barlinecols : A tuple of `~matplotlib.collections.LineCollection` with the
          horizontal and vertical error ranges.

    has_xerr, has_yerr : bool
        ``True`` if the errorbar has x/y errors.


Review comment (suggestion):
```suggestion
            raise ValueError("orientation is not 'vertical' or 'horizontal'.")
```

Code after:
    def bottoms(self):
        """
        Return the values at the lower end of the bars.

        .. versionadded:: 3.11
        """
        if self.orientation == 'vertical':
            return [p.get_y() for p in self.patches]
        elif self.orientation == 'horizontal':
            return [p.get_x() for p in self.patches]
        else:
            raise ValueError("orientation must be 'vertical' or 'horizontal'.")

    @property
    def tops(self):
        """
        Return the values at the upper end of the bars.

        .. versionadded:: 3.11
        """
        if self.orientation == 'vertical':
            return [p.get_y() + p.get_height() for p in self.patches]
        elif self.orientation == 'horizontal':
            return [p.get_x() + p.get_width() for p in self.patches]
        else:
            raise ValueError("orientation must be 'vertical' or 'horizontal'.")

    @property
    def position_centers(self):
        """
        Return the centers of bar positions.

        .. versionadded:: 3.11
        """
        if self.orientation == 'vertical':
            return [p.get_x() + p.get_width() / 2 for p in self.patches]
        elif self.orientation == 'horizontal':
            return [p.get_y() + p.get_height() / 2 for p in self.patches]
        else:
            raise ValueError("orientation must be 'vertical' or 'horizontal'.")


class ErrorbarContainer(Container):
    """
    Container for the artists of error bars (e.g. created by `.Axes.errorbar`).

    The container can be treated as the *lines* tuple itself.
    Additionally, you can access these and further parameters by the
    attributes.

    Attributes