Skip to main content

Tiny package to make 'race' barplots using plotly

Project description

Making race plots with Plotly!

Bar race plots, barchart race plots or simply race plots are very common when evaluating rankings over time. Python plotting is not the most user friendly and whenever I've wanted to make race plots I have ended up with tonnes of code for what is a simple plot in the end. I wish to remove that headache for many users that simply want to make quick plot and then move on.

The package only contains one module called barplot. This module takes the following arguments at initialisation:

  • df: (type: pandas.DataFrame) dataframe from which to query data
  • item_column: (type: string) Name of column describing the items to be ranked (e.g. countries, corporations, names of people...)
  • value_column: (type: string) Name of column describing the value to be used for ranking (e.g. GDP, population, volume of sales...)
  • time_column: (type: string) Name of column describing the time variable. This must be a sequence (e.g. years, days). Support of Date format has not been tested yet.
  • top_entries: (type: numeric) Number of top entries to display (e.g. 5 for top 5 for any given time period...)

The barplot object contains one main method:

  • plot(title, orientation, item_label, value_label):
    • title: (type: string) Main title of the plot (static by default)
    • orientation: (type: string -> 'horizontal' or 'vertical') whether bars grow upwards ('vertical') or rightwards ('horizontal')
    • item_label: (type: string) Title of the axis corresponding to the item values
    • value_label: (type: string) Title of the axis corresponding to the value

Example plot: Top 10 crops from 1961 to 2018

import pandas
from raceploty.plots import barplot

FAO = pd.read_csv('https://github.com/lc5415/raceplotly/blob/main/example/FAOSTAT_data.csv')

my_raceplot = barplot(data,  item_column='Item', value_column='Value', time_column='Year')

my_raceplot.plot(item_label = 'Top 10 crops', value_label = 'Production quantity (tonnes)', frame_duration = 800)

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

raceplotly-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raceplotly-0.1.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file raceplotly-0.1.1.tar.gz.

File metadata

  • Download URL: raceplotly-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for raceplotly-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ec0a384dc5eba781bb03272559e514499f12484c4f6649f126270201b8b7e4be
MD5 e72a63f7704a0c158c944b05d1a8e043
BLAKE2b-256 891694305b2cb855a79bcfb95218c4e18146ee5f9df63744c9ce3f49e3ea9342

See more details on using hashes here.

File details

Details for the file raceplotly-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: raceplotly-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for raceplotly-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db6576584aeb1b35b47d6352723ea13d24ddfb6ce3a1f0764df228a61688ea53
MD5 6ea3f0f56a1f41243b60c4e7fe681cb0
BLAKE2b-256 59699b2e117ed4d1547feb8124b5c3daa331d447425852f5d9871b50fa00a3c3

See more details on using hashes here.

Supported by

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