bar_chart_race
bar_chart_race copied to clipboard
X-axis label number format
Hi,
is there a way to change the number format in X-axis?, in my country the comma is used as decimal separator, I tried to fix this with the import of locale library, but the issue continues...
Here's another question on the same topic: https://stackoverflow.com/questions/69795740/python-package-bar-chart-race-0-1-0-cant-change-separator-thousands-to-dot
When you install barchartrace via pip or conda, this currently installs an old version which doesn't allow you to change the text formatting locale.
So, uninstall the version you currently have and install the latest version of bar chart race as follows in your command line. You do need to have git installed for this:
pip uninstall bar_chart_race
pip install git+https://github.com/dexplo/bar_chart_race
And then you set your locale so that you get comma separators for decimals.
Working code example in Jupyter notebooks:
import bar_chart_race as bcr
import locale
locale.setlocale(locale.LC_NUMERIC, "de_DE")
df = bcr.load_dataset('covid19_tutorial')
bcr.bar_chart_race(
df=df,
filename=None,
bar_texttemplate='{x:n}',
tick_template='{x:n}',
)
When you install barchartrace via pip or conda, this currently installs an old version which doesn't allow you to change the text formatting locale.
So, uninstall the version you currently have and install the latest version of bar chart race as follows in your command line. You do need to have git installed for this:
pip uninstall bar_chart_race pip install git+https://github.com/dexplo/bar_chart_race
And then you set your locale so that you get comma separators for decimals. Working code example in Jupyter notebooks:
import bar_chart_race as bcr import locale locale.setlocale(locale.LC_NUMERIC, "de_DE") df = bcr.load_dataset('covid19_tutorial') bcr.bar_chart_race( df=df, filename=None, bar_texttemplate='{x:n}', tick_template='{x:n}', )
Thank you very much mate! I' waited months for an answer for this issue
regards