Repository: ManimCommunity/manim
File: manim/mobject/three_dimensions.py (Python)

Code before:
        self.add(*faces)
        if self.checkerboard_colors:
            self.set_fill_by_checkerboard(*self.checkerboard_colors)

    def set_fill_by_checkerboard(self, *colors, opacity=None):
        n_colors = len(colors)
        for face in self:
            c_index = (face.u_index + face.v_index) % n_colors
            face.set_fill(colors[c_index], opacity=opacity)
        return self

    def set_fill_by_value(self, axes: "Mobject", colors: Union[Iterable[Color], Color]):
        """Sets the color of each face of a parametric surface to a color relative to it's z-value

        Parameters
        ----------
        axes :
            The axes for the parametric surface.
        colors :
            A list of colors, ordered from lower z-values to higher z-values. If a list of tuples is passed
            containing colors paired with numbers, then those numbers will be used as the pivots.

        Returns
        -------
        :class:`~.ParametricSurface`
            The parametric surface with a gradient applied by value

        Examples
        --------
        .. manim:: Fill_by_valueExample
            :save_last_frame:

            class Fill_by_valueExample(ThreeDScene):
                def construct(self):
                    resolution_fa = 84
                    self.set_camera_orientation(phi=75 * DEGREES, theta=-120 * DEGREES)
                    axes = ThreeDAxes(x_range=(0, 5, 1), y_range=(0, 5, 1), z_range=(-1, 1, 0.5))
                    def param_surface(u, v):
                        x = u
                        y = v
                        z = np.sin(x) * np.cos(y)
                        return z
                    surface_plane = ParametricSurface(
                        lambda u, v: axes.c2p(u, v, param_surface(u, v)),
                        resolution=(resolution_fa, resolution_fa),
                        v_min=0,
                        v_max=5,
                        u_min=0,
                        u_max=5)
                    surface_plane.set_style(fill_opacity=1)
                    surface_plane.set_fill_by_value(axes=axes, colors=[(RED, -0.4), (YELLOW, 0), (GREEN, 0.4)])

Review comment (suggestion):
```suggestion
            The parametric surface with a gradient applied by value. For chaining.
```

Code after:
                        [u2, v1, 0],
                        [u2, v2, 0],
                        [u1, v2, 0],
                        [u1, v1, 0],
                    ]
                )
                faces.add(face)
                face.u_index = i
                face.v_index = j
                face.u1 = u1
                face.u2 = u2
                face.v1 = v1
                face.v2 = v2
        faces.set_fill(color=self.fill_color, opacity=self.fill_opacity)
        faces.set_stroke(
            color=self.stroke_color,
            width=self.stroke_width,
            opacity=self.stroke_opacity,
        )
        self.add(*faces)
        if self.checkerboard_colors:
            self.set_fill_by_checkerboard(*self.checkerboard_colors)

    def set_fill_by_checkerboard(self, *colors, opacity=None):
        n_colors = len(colors)
        for face in self:
            c_index = (face.u_index + face.v_index) % n_colors
            face.set_fill(colors[c_index], opacity=opacity)
        return self

    def set_fill_by_value(self, axes: "Mobject", colors: Union[Iterable[Color], Color]):
        """Sets the color of each mobject of a parametric surface to a color relative to its z-value

        Parameters
        ----------
        axes :
            The axes for the parametric surface, which will be used to map z-values to colors.
        colors :
            A list of colors, ordered from lower z-values to higher z-values. If a list of tuples is passed
            containing colors paired with numbers, then those numbers will be used as the pivots.

        Returns
        -------
        :class:`~.ParametricSurface`
            The parametric surface with a gradient applied by value. For chaining.

        Examples
        --------
        .. manim:: FillByValueExample
            :save_last_frame: