Skip to main content

Animate a timelapse of word cloud

Project description

AnimatedWordCloudTimelapse ver 1.0.-1

UNDER CONSTRUCTION

Codacy Badge unit-testcodecov

AnimatedWordCloudTimelapse animates the timelapse of your words vector.

Examples!

Using Elon Musk's tweets.
(C) Elon Musk

ElonMuskExample

How to use?

Requirements

Python (3.8 <= version <= 3.12)

install

(scheduled)

pip install AnimatedWordCloudTimelapse

coding

Using default configuration

from AnimatedWordCloudTimelapse import animate

# data must be list[("time name", dict[str, float])]
timelapse_wordvector = [
    (
        "time_0",
        {
            "hanshin":0.334,
            "chiba":0.226
        }
    ),
    (
        "time_1",
        {
            "hanshin":0.874,
            "fujinami":0.609
        }
    ),
    (
        "time_2",
        {
            "fujinami":0.9,
            "major":0.4
        }
    )
]

# animate!
# the animation gif path is in this variable!
path = animate(timelapse_wordvector)

Editing configuration

from AnimatedWordCloudTimelapse import animate, Config

config = Config(
    what_you_want_to_edit = editing_value
)

timelapse = # adding time lapse data

#give the config to second parameter
animate(timelapse, config)
Parameters of Config

All has default value, so just edit what you need

parameter name type meaning
font_path str Path to the font file.
output_path str Parh of the output directory
max_words int max number of the words in the screen
max_font_size int Maximum font size of the word
min_font_size int Minimum font size of the word
image_width int Width of the image
image_height int Height of the image
background_color str Background color.
This is based on Pillow.Image.new()
color_map str color map used for coloring words
This is based on matplotlib colormap
allocation_strategy str(literal) allocation algorithm method. This will change the allocation of the words in the output.
There is "magnetic" now.
image_division int precision of allocation calculation. Higher the preciser, but calculation slower
verbosity str(literal) logging.
silent: nothing
minor: bars to know the progress
debug: all progress. noisy
transition_symbol str written in the image
starting_time_stamp str time stamp of the first frame (before the first time stamp in the input timelapse data)
duration_per_interpolation_frame int milliseconds per interpolation frame
duration_per_static_frame int milliseconds per staic (frame correspond to timestamp of wordvector) frame
n_frames_for_interpolation int how many frames will be generated for interpolation between each frames
interpolation_method str(literal) The method of making movement
There is "linear" now
drawing_time_stamp bool Whether to draw time stamp on the image
time_stamp_color str Color of the time stamp. This is based on Pillow ImageColor
time_stamp_font_size int Font size of the time stamp.
If None(default), it will be set to 75% of max_font_size
time_stamp_position tuple[int, int] Position of the time stamp.
If None(default), it will be set to (image_width0.75, image_height0.75) which is right bottom.
intermediate_frames_id str Static images of each frame of itermediate product will be saved as "{intermediateframes_id}{frame_number}.png".
If None(default), this will be set randomly.

Want to contribute?

Look at CONTRIBUTING.md first.

Maintainers

Want to support?

⭐Give this project a star⭐
This is our first OSS project, ⭐star⭐ would make us very happy⭐⭐⭐

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AnimatedWordCloudTimelapse-0.9.1.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file AnimatedWordCloudTimelapse-0.9.1.tar.gz.

File metadata

File hashes

Hashes for AnimatedWordCloudTimelapse-0.9.1.tar.gz
Algorithm Hash digest
SHA256 b2003b4fbfbcec0900a78882c324536185709bcead40ee1895e30f5b0bbfe675
MD5 b8c60debdc6e5ed32dea1a89d7be9691
BLAKE2b-256 b5fa3f7e8ba04c0f27078107abf79f6ed665b0a4b594ccc812a4a6c92fb940d9

See more details on using hashes here.

File details

Details for the file AnimatedWordCloudTimelapse-0.9.1-py3-none-any.whl.

File metadata

File hashes

Hashes for AnimatedWordCloudTimelapse-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab2cc14fc9bd68c69133eedf01f90919db1e03ded799743803e550e14f3c2bff
MD5 79e1a8b2b53ba184cdd053af3b714500
BLAKE2b-256 24d280ea0148019b3e31f1f75a1fb4909421a1a880415008e30eb1c49f4c82b7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page