Skip to main content
Data Visualization
CHAPTER 02 Beginner

Installing Python and Visualization Libraries

Updated: May 18, 2026
5 min read

# CHAPTER 2

Installing Python and Visualization Libraries

1. Chapter Introduction

A properly configured environment is the foundation of productive visualization work. This chapter installs and verifies all major Python visualization libraries — Matplotlib, Seaborn, Plotly, and Dash.

2. Installation

bash
1234567891011
# Create virtual environment
python -m venv viz_env
viz_env\Scripts\activate      # Windows
source viz_env/bin/activate   # Mac/Linux

# Install all visualization libraries
pip install matplotlib seaborn plotly dash pandas numpy jupyter

# Optional but recommended
pip install plotly-express kaleido   # Static image export for Plotly
pip install nbformat ipywidgets      # Jupyter widgets

3. Verify Installation

python
12345678910111213141516171819202122232425262728293031
import matplotlib
import seaborn as sns
import plotly
import pandas as pd
import numpy as np

print(f"Matplotlib: {matplotlib.__version__}")   # 3.8.x
print(f"Seaborn:    {sns.__version__}")          # 0.13.x
print(f"Plotly:     {plotly.__version__}")       # 5.18.x
print(f"Pandas:     {pd.__version__}")           # 2.1.x
print(f"NumPy:      {np.__version__}")           # 1.26.x

# Quick test — all three libraries
import matplotlib.pyplot as plt
import plotly.express as px

# Matplotlib test
fig, ax = plt.subplots()
ax.plot([1,2,3], [4,5,6])
ax.set_title('Matplotlib ✅')
plt.savefig('test_mpl.png')

# Seaborn test
sns.set_theme()
print("Seaborn ✅")

# Plotly test
fig = px.line(x=[1,2,3], y=[4,5,6], title='Plotly ✅')
fig.show()

print("\n✅ All visualization libraries ready!")

4. Library Overview

text
12345678910
+────────────────────────────────────────────────────────────────────+
│ Library    │ Type        │ Best For                    │ Output    │
+────────────+─────────────+─────────────────────────────+───────────+
│ Matplotlib │ Static      │ Publication-quality charts  │ PNG/PDF   │
│ Seaborn    │ Statistical │ Statistical plots, EDA      │ PNG/PDF   │
│ Plotly     │ Interactive │ Web dashboards, hover info  │ HTML/JSON │
│ Dash       │ Dashboard   │ Full web analytics apps     │ Web app   │
│ Bokeh      │ Interactive │ Streaming, large datasets   │ HTML      │
│ Altair     │ Declarative │ Grammar-of-graphics style   │ HTML/PNG  │
+────────────+─────────────+─────────────────────────────+───────────+

5. Jupyter Notebook Setup

python
12345678910111213141516171819202122
# Launch Jupyter
# jupyter notebook   # Classic
# jupyter lab        # Modern (recommended)

# Essential magic commands for visualization
%matplotlib inline    # Show Matplotlib plots in notebook
%matplotlib widget    # Interactive Matplotlib in JupyterLab

# Global style settings (add to first cell of every notebook)
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')

plt.style.use('seaborn-v0_8-whitegrid')
plt.rcParams['figure.figsize'] = (10, 6)
plt.rcParams['font.size'] = 12
plt.rcParams['axes.titlesize'] = 14
plt.rcParams['axes.titleweight'] = 'bold'
sns.set_palette('husl')

print("Visualization environment ready!")

6. Common Mistakes

  • Not using virtual environments: Installing visualization libraries globally causes conflicts with other projects. Always use venv or conda.
  • Missing kaleido for Plotly static exports: fig.writeimage('chart.png') requires pip install kaleido.

7. MCQs

Question 1

Plotly is best for?

Question 2

%matplotlib inline in Jupyter?

Question 3

Seaborn is built on top of?

Question 4

kaleido package is needed for?

Question 5

Dash is for building?

Question 6

plt.rcParams sets?

Question 7

sns.settheme() applies?

Question 8

Best IDE for interactive visualization?

Question 9

pip install plotly-express installs?

Question 10

Virtual environment purpose in visualization projects?

8. Interview Questions

  • Q: What is the difference between Matplotlib and Plotly?
  • Q: When would you choose Seaborn over Matplotlib?

9. Summary

Install the visualization stack: pip install matplotlib seaborn plotly dash pandas numpy jupyter. Matplotlib for publication-quality static charts, Seaborn for statistical analysis, Plotly for interactive web charts, Dash for full dashboards. Always configure global rcParams for consistent aesthetics.

10. Next Chapter Recommendation

In Chapter 3: Understanding Data and Visualization Principles, we learn data types, chart selection logic, and the psychology behind effective visualization.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·