Set up Flourish Charts
Getting started with Flourish Charts requires downloading from PyPi or CRAN (or alternatively, our GitHub repository) and setting up a Flourish API key.
Python package installation
If installing to a virtual environment, you can install Flourish Charts using pipenv
:
pipenv install flourishcharts
If using a local machine Python installation, install Flourish Charts to your global Python installation with pip
:
python3 -m pip install --upgrade flourishcharts
R package installation
To install from CRAN, run:
install.packages("flourishcharts")
To install the latest R package version from GitHub (as the CRAN package will only be updated on a quarterly basis instead of every two weeks):
remotes::install_github("canva-public/flourishcharts", subdir = "R_package")
Flourish API key
The Flourish Charts package is dependent on the Flourish Live API, an enterprise bolt-on allowing users to programatically create Flourish visualizations. To use this package, you must have access to the API.
-
The first step is to create an API key. This can be generated from your Flourish account page.
-
Python users can store their Flourish API key in one of the three potential places:
- Inside the
Flourish()
function, which has a parameter calledapi_key
. Pass a string to this argument. - If you install a global copy of the package: in a
~/.zshrc
or~/.bashrc
file where you can store sensitive bits of information or, alternatively, information you want accessible. This is safer as the API key cannot be accessed if you decide to share the Python file containing Flourish Charts code. - If you install to a virtual environment: in a
.envrc
file where you can store sensitive bits of information or, alternatively, information you want accessible every time you run Python code within the environment. This is safer as the information cannot be accessed if you decide to share the Python file containing Flourish Charts code.
If you choose one of the latter two options, store your key in the file as follows:
export FLOURISH_API_KEY="..."sh - Inside the
-
Restart your terminal after saving the variable for it to take effect or (if using a virtual environment) run
direnv allow
in your directory.