Skip to main content

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 DynamicPygameGraphs. 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 = DynamicPygameGraphs(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, zero_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

Metadata

Release files for dynamic-graphs-with-pygame 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dynamic-graphs-with-pygame 1.2.0
File Size Uploaded
dynamic_graphs_with_pygame-1.2.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dynamic-graphs-with-pygame 1.2.0
File Interpreter ABI Platform
dynamic_graphs_with_pygame-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / dynamic_graphs_with_pygame-1.2.0.tar.gz

Download URL dynamic_graphs_with_pygame-1.2.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
397a304ddc115ed15415bdba848b435afa87f4670090cb2022f62aea6bfdeb11
BLAKE2b-256 checksum
How to use checksums
2cba6d76d5a54efc9fe9e52fa99307d2e484a689422fa4d046fd922a7894c4d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release files / dynamic_graphs_with_pygame-1.2.0-py3-none-any.whl

Download URL dynamic_graphs_with_pygame-1.2.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe3112df080a5635d4b665572941be20e6925e2425b69f5c53d46b34239ad940
BLAKE2b-256 checksum
How to use checksums
08f88bac25271d54d4752b15f6d8c6d6b20c1b6794beb2b7c156f7a347a4bcdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page