Repository: ManimCommunity/manim

Issue:
Weird line when plotting staircase function
## Description of bug / unexpected behavior
I tried to plot a staircase function with a logarithmic x axis. The function is plotted correctly but there is a line in the graph that does not belong to the staircase function.


## Expected behavior
Do not print the line that does not belong to the function.


## How to reproduce the issue

Put the below code in `staircase.py` and run `manim -pql staircase.py BuggyStaircase`.

<details><summary>Code for reproducing the problem</summary>

```py
from manim import *

class BuggyStaircase(Scene):
    def construct(self):
        axes = Axes(
            x_range=[-1, 5, 1],
            y_range=[0, 30, 5],
            x_axis_config={"scaling": LogBase()},
        )

        price = lambda x: 21 if x < 180 else 10 if x < 6000 else 6

        graph = axes.plot(price, x_range=[-1, 4.9, 0.001], use_smoothing=False)

        self.add(axes, graph)
```

</details>


## Additional media files
<!-- Paste in the files manim produced on rendering the code above. -->

<details><summary>Images/GIFs</summary>

![bug](https://user-images.githubusercontent.com/39318299/153752124-dd204987-56a2-49d9-a7fc-f247f7e52878.png)

</details>


## Logs
<details><summary>Terminal output</summary>
<!-- Add "-v DEBUG" when calling manim to generate more detailed logs -->

```
Manim Community v0.14.0

[02/13/22 13:02:25] INFO                                                                                                                                      scene_file_writer.py:729
                             File ready at '/home/something/something/media/images/staircase/BuggyStaircase_ManimCE_v0.14.0.png'                                                   
                                                                                                                                                                                      
                    INFO     Rendered BuggyStaircase                                                                                                                      scene.py:237
                             Played 0 animations                                                                                                                                      
                    INFO     Previewed File at: '/home/something/something/media/images/staircase/BuggyStaircase_ManimCE_v0.14.0.png'                               file_ops.py:202
```

<!-- Insert screenshots here (only when absolutely necessary, we prefer copy/pasted output!) -->

</details>


## System specifications

<details><summary>System Details</summary>

- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Arch Linux
- RAM: 16 GB
- Python version (`python/py/python3 --version`): 3.10.2
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```
</details>

<details><summary>LaTeX details</summary>

+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
PASTE HERE
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->



Discussion:

Resolving patch:
diff --git a/manim/mobject/functions.py b/manim/mobject/functions.py
--- a/manim/mobject/functions.py
+++ b/manim/mobject/functions.py
@@ -143,7 +143,10 @@ def generate_points(self):
 
         for t1, t2 in zip(boundary_times[0::2], boundary_times[1::2]):
             t_range = np.array(
-                [*self.scaling.function(np.arange(t1, t2, self.t_step)), t2],
+                [
+                    *self.scaling.function(np.arange(t1, t2, self.t_step)),
+                    self.scaling.function(t2),
+                ],
             )
             points = np.array([self.function(t) for t in t_range])
             self.start_new_path(points[0])


Test patch:
diff --git a/tests/test_graphical_units/control_data/coordinate_system/plot_log_x_axis.npz b/tests/test_graphical_units/control_data/coordinate_system/plot_log_x_axis.npz
new file mode 100644
Binary files /dev/null and b/tests/test_graphical_units/control_data/coordinate_system/plot_log_x_axis.npz differ
diff --git a/tests/test_graphical_units/test_coordinate_systems.py b/tests/test_graphical_units/test_coordinate_systems.py
--- a/tests/test_graphical_units/test_coordinate_systems.py
+++ b/tests/test_graphical_units/test_coordinate_systems.py
@@ -44,6 +44,19 @@ def test_implicit_graph(scene):
     scene.add(ax, graph)
 
 
+@frames_comparison
+def test_plot_log_x_axis(scene):
+    ax = Axes(
+        x_range=[-1, 4],
+        y_range=[0, 3],
+        x_axis_config={"scaling": LogBase()},
+    )
+
+    graph = ax.plot(lambda x: 2 if x < 10 else 1, x_range=[-1, 4])
+
+    scene.add(ax, graph)
+
+
 @frames_comparison
 def test_number_plane_log(scene):
     """Test that NumberPlane generates its lines properly with a LogBase"""