dexplo / bar_chart_race

Create animated bar chart races in Python with matplotlib
MIT License
1.35k stars 351 forks source link

Formatting of bar text #80

Closed cristianoarbex closed 2 months ago

cristianoarbex commented 2 months ago

Dear dexplo,

First, thanks for the great work! I have one question. In your basic example in README.md, you show a COVID chart with the following parameters:

bar_textposition='inside', bar_texttemplate='{x:,.0f}', bar_label_font=7

To my understanding this would allow us to format the text displayed together with the bar chart. However, in the most recent version in Python 3.10 (using on Ubuntu 22), with pandas and matplotlib up-to-date,there are none of these options apparently? I get the following error:

TypeError: bar_chart_race() got an unexpected keyword argument 'bar_textposition'

By opening _make_chart.py, function plot_bars(...), lines 376 and 382 display a hardcoded text formatting:

text = f'{y1:,.0f}'

Are these missing options new, not yet published in the official pip version?

Thank you very much, Cristiano

cristianoarbex commented 2 months ago

Ok so apparently the version here on github is very different from the version I get when I install the package with pip... I wonder why?

cristianoarbex commented 2 months ago

Resolved by installing the package as:

pip install git+https://github.com/dexplo/bar_chart_race.git