Aketch  Rachel

Aketch Rachel

1624964760

Altair: Interactive Data Visualizations in Python Made Easy

Data visualization helps us make sense of overwhelming and messy collections of tabular data. As a go-to language for data science, Python has several excellent data visualization libraries. One of them is Altair, and you’ll learn the basics of it today.

As a data scientist, visual representation of data is a must, especially when presenting data and insights to a less technical audience. You should also pay attention to the aesthetics of your visualizations, and that’s where Altair shines. You can easily make stunning interactive charts, something not easily achievable with Matplotlib.

Altair can also be used to build and deploy interactive reports. This article explains how

Today’s article is structured as follows:

  • Altair Installation and Dataset Introduction
  • Altair Basics — Simple Area Chart
  • Basic Styles With Altair
  • Advanced Style With Altair — Gradients
  • Adding Interactivity
  • Saving Charts
  • Final Words

Altair Installation and Dataset Introduction

You can install Altair as any other Python library. We’ll install it in a separate virtual environment called altair_env, based on Python version 3.8.

Numpy and Pandas are dependencies of Altair, so you don’t have to install them manually. If you’re using Anaconda, the following set of shell commands will set up the environment, activate it, and install everything needed:

conda create — name altair_env python=3.8
conda activate altair_env

conda install -c conda-forge altair altair_saver
conda install -c anaconda pandas-datareader
conda install jupyter jupyterlab

Awesome! You can now launch Jupyter Lab and create a new empty notebook.

#data-visualization #towards-data-science #data-science #python #altair

Altair: Interactive Data Visualizations in Python Made Easy