ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
26.48k stars 1.82k forks source link

Axes and the unit_size #3892

Closed TueNguyen2006 closed 3 months ago

TueNguyen2006 commented 3 months ago

Description of bug / unexpected behavior

class test(Scene):
    def construct(self):
        self.graph_plane_config = {
            "x_range": [0, 4.3 * PI, PI],
            "y_range": [-2, 2, 1],

            "x_axis_config": {
                "unit_size": 2, #try another number and it's similar
            },
            "y_axis_config": {
                "unit_size": 1, #try another number and it's similar
            },
        }
        a = Axes(**self.graph_plane_config)
        self.add(a)

In the class Axes(), in the "x_axis_config" and "y_axis_config", when i change "unit_size" or "length", the result doesn't change

Expected behavior

How to reproduce the issue

Code for reproducing the problem ```py ```

Additional media files

Images/GIFs

Logs

Terminal output ``` PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR ```

System specifications

System Details - OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): - RAM: - Python version (`python/py/python3 --version`): - Installed modules (provide output from `pip list`): ``` PASTE HERE ```
LaTeX details + LaTeX distribution (e.g. TeX Live 2020): + Installed LaTeX packages:

Additional comments

uwezi commented 3 months ago

Just set the lengths of the axes in the main object's parameters.

The axis_config are mostly meant for cosmetic changes to the looks of the axes, not to their scaling.

class test(Scene):
    def construct(self):
        self.graph_plane_config = {
            "x_range": [0, 4.1 * PI, PI],
            "y_range": [-2, 2, 1],
            "x_length": 4.1*PI,
            "y_length": 4,
            "tips":False,
            "x_axis_config": {
                "decimal_number_config": {"num_decimal_places":2},
             },
        }

        a = Axes(**self.graph_plane_config).add_coordinates()
        self.add(a)

bild

TueNguyen2006 commented 3 months ago

Thanks!! I think this should be corrected in the web documentation because everything I learn is from the web community

uwezi commented 3 months ago

Thanks!! I think this should be corrected in the web documentation because everything I learn is from the web community

Where exactly did you find this information in the documentation? I cannot find a single mention of changing the scaling with these parameters, nor any example using a construction like your self.graph_plane_config in the ManimCE documentation.

Also if you want to learn more about Manim come over to Discord: https://docs.manim.community/en/stable/faq/general.html?highlight=discord#where-can-i-find-more-resources-for-learning-manim