dynamic-graphs-with-pygame


Namedynamic-graphs-with-pygame JSON
Version 1.0.9 PyPI version JSON
download
home_pagehttps://github.com/ChrisBotos/Dynamic_Graphs_with_Pygame
SummaryA class for drawing dynamic graphs using Pygame.
upload_time2024-04-01 11:42:43
maintainerNone
docs_urlNone
authorChristos Botos
requires_pythonNone
licenseNone
keywords pygame graphs dynamic visualization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Dynamic_Graphs_with_Pygame
This is a python library created using pygame that manages the creation of graphs that update dynamically displaying the changes of x and y over time.

# How to install
This package will be added to pip so a simple "pip install dynamic_graphs_with_pygame" would suffice.
Otherwise, clone the GitHub repository.

# Possible uses
Right now the supported graphs that can be made are: histograms, line_graphs and scatter plots. 
You may use the library's logic to add your own type of graphs as well! 
It is fairly easy just look at how the existing functions were made and do something similar.
Attention! Pygame has limitations with displaying very small objects, take note of that and look at how the case of histogram bin width < 1 is handled.

Be sure to take advantage of the ability of this library to draw objects in pygame that have alpha (transparency).
This way you can display different graphs on top of each other.

# How to use
Take a look at the example_usage.py too.

Take note that all the functions exist inside a class called dynamic_pygame_graphs_class.
Essentially you need to first make an instance of this class with details like the positions of the axes and the pygame screen you want to display it in. (your x values are allowed to be larger than the size of of the graph_x axis)

Example:
pygame_graphs_instance = dynamic_pygame_graphs_class(x, y, screen)

Afterwards you can use this instance to draw a graph of your choosing on screen.

Example:
pygame_graphs_instance.dynamic_histogram(x_values=np.array([1, 0, 2, 3, 0, 1]),
                                         bin_size=1,
                                         bar_color=(255, 0, 0, 123),
                                         graph_x=500,
                                         graph_y=500,
                                         graph_x_axis_name='',
                                         graph_y_axis_name='',
                                         x_tick_marks=5,
                                         y_tick_marks=5,
                                         y_amplifier=1,
                                         graph_tick_marks_font=None,
                                         graph_tick_marks_text_color=(0, 0, 0),
                                         graph_tick_marks_text_space_from_x_axis=10,
                                         graph_tick_marks_text_space_from_y_axis=20,
                                         move_zero_along_x_axis=0,
                                         move_zero_along_x_axis_tick_mark_text_color=(0, 0, 0),
                                         bin_array_is_given_as_x_values=True,
                                         have_extra_bin=True)

Of course, you do not need to fill all those variables, they all have pre-given values.
As for what exactly all of them mean refer to the comments in the actual code.

Scrolling is achieved by the keyboard arrows by default. 
You may change that, look at the scroll function.

Attention: For the histogram, if you want some of your bins to be displayed as negative along the x_axis take advantage of move_zero_along_x_axis parameter to set which bin corresponds to the zero position.

Attention: If your arrays are getting ever bigger the dynamic graphs may start lagging after a while. 
A solution would be to maybe delete some elements from the arrays if their lengths pass a specific threshold.

# Was made using
Python 3.12.2
Pygame 2.5.2
numpy 1.26.4


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ChrisBotos/Dynamic_Graphs_with_Pygame",
    "name": "dynamic-graphs-with-pygame",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pygame graphs dynamic visualization",
    "author": "Christos Botos",
    "author_email": "hcty02@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c0/33/b56fe8308823cac6aeb078b8f0502c691c22bfd2540070e841af4bbf127c/dynamic_graphs_with_pygame-1.0.9.tar.gz",
    "platform": null,
    "description": "# Dynamic_Graphs_with_Pygame\nThis is a python library created using pygame that manages the creation of graphs that update dynamically displaying the changes of x and y over time.\n\n# How to install\nThis package will be added to pip so a simple \"pip install dynamic_graphs_with_pygame\" would suffice.\nOtherwise, clone the GitHub repository.\n\n# Possible uses\nRight now the supported graphs that can be made are: histograms, line_graphs and scatter plots. \nYou may use the library's logic to add your own type of graphs as well! \nIt is fairly easy just look at how the existing functions were made and do something similar.\nAttention! Pygame has limitations with displaying very small objects, take note of that and look at how the case of histogram bin width < 1 is handled.\n\nBe sure to take advantage of the ability of this library to draw objects in pygame that have alpha (transparency).\nThis way you can display different graphs on top of each other.\n\n# How to use\nTake a look at the example_usage.py too.\n\nTake note that all the functions exist inside a class called dynamic_pygame_graphs_class.\nEssentially you need to first make an instance of this class with details like the positions of the axes and the pygame screen you want to display it in. (your x values are allowed to be larger than the size of of the graph_x axis)\n\nExample:\npygame_graphs_instance = dynamic_pygame_graphs_class(x, y, screen)\n\nAfterwards you can use this instance to draw a graph of your choosing on screen.\n\nExample:\npygame_graphs_instance.dynamic_histogram(x_values=np.array([1, 0, 2, 3, 0, 1]),\n                                         bin_size=1,\n                                         bar_color=(255, 0, 0, 123),\n                                         graph_x=500,\n                                         graph_y=500,\n                                         graph_x_axis_name='',\n                                         graph_y_axis_name='',\n                                         x_tick_marks=5,\n                                         y_tick_marks=5,\n                                         y_amplifier=1,\n                                         graph_tick_marks_font=None,\n                                         graph_tick_marks_text_color=(0, 0, 0),\n                                         graph_tick_marks_text_space_from_x_axis=10,\n                                         graph_tick_marks_text_space_from_y_axis=20,\n                                         move_zero_along_x_axis=0,\n                                         move_zero_along_x_axis_tick_mark_text_color=(0, 0, 0),\n                                         bin_array_is_given_as_x_values=True,\n                                         have_extra_bin=True)\n\nOf course, you do not need to fill all those variables, they all have pre-given values.\nAs for what exactly all of them mean refer to the comments in the actual code.\n\nScrolling is achieved by the keyboard arrows by default. \nYou may change that, look at the scroll function.\n\nAttention: For the histogram, if you want some of your bins to be displayed as negative along the x_axis take advantage of move_zero_along_x_axis parameter to set which bin corresponds to the zero position.\n\nAttention: If your arrays are getting ever bigger the dynamic graphs may start lagging after a while. \nA solution would be to maybe delete some elements from the arrays if their lengths pass a specific threshold.\n\n# Was made using\nPython 3.12.2\nPygame 2.5.2\nnumpy 1.26.4\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A class for drawing dynamic graphs using Pygame.",
    "version": "1.0.9",
    "project_urls": {
        "Homepage": "https://github.com/ChrisBotos/Dynamic_Graphs_with_Pygame",
        "LinkedIn": "https://www.linkedin.com/in/your_username/"
    },
    "split_keywords": [
        "pygame",
        "graphs",
        "dynamic",
        "visualization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47456f68e8871fd8c3a3b85cf3382767d7a48b5164a6c25ebc81dcfaca89b783",
                "md5": "cc163dff6c35216450201e2ab783c69e",
                "sha256": "4d2f9f4eacad6794243068c1d08149f7e9815535a01f80bb732bc648e3602c6d"
            },
            "downloads": -1,
            "filename": "dynamic_graphs_with_pygame-1.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cc163dff6c35216450201e2ab783c69e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8797,
            "upload_time": "2024-04-01T11:42:41",
            "upload_time_iso_8601": "2024-04-01T11:42:41.510438Z",
            "url": "https://files.pythonhosted.org/packages/47/45/6f68e8871fd8c3a3b85cf3382767d7a48b5164a6c25ebc81dcfaca89b783/dynamic_graphs_with_pygame-1.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c033b56fe8308823cac6aeb078b8f0502c691c22bfd2540070e841af4bbf127c",
                "md5": "225fda93a4b01c60d86af9b448e1a443",
                "sha256": "3e4913d09fcf763c8b16edf51f41c7f19499eac1fb48a681b3dbee1f4378d48e"
            },
            "downloads": -1,
            "filename": "dynamic_graphs_with_pygame-1.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "225fda93a4b01c60d86af9b448e1a443",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9535,
            "upload_time": "2024-04-01T11:42:43",
            "upload_time_iso_8601": "2024-04-01T11:42:43.387786Z",
            "url": "https://files.pythonhosted.org/packages/c0/33/b56fe8308823cac6aeb078b8f0502c691c22bfd2540070e841af4bbf127c/dynamic_graphs_with_pygame-1.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-01 11:42:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ChrisBotos",
    "github_project": "Dynamic_Graphs_with_Pygame",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "dynamic-graphs-with-pygame"
}
        
Elapsed time: 0.22329s