this is the nav!
Data Visualization in Python
• AI Chat
• Code
• Report
• ## .mfe-app-workspace-kj242g{position:absolute;top:-8px;}.mfe-app-workspace-11ezf91{display:inline-block;}.mfe-app-workspace-11ezf91:hover .Anchor__copyLink{visibility:visible;}Data Visualization in Python

```.mfe-app-workspace-11z5vno{font-family:JetBrainsMonoNL,Menlo,Monaco,'Courier New',monospace;font-size:13px;line-height:20px;}```%%capture
!pip install vega-datasets altair folium``````

### Static Plots

#### Matplotlib

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Matplotlib makes easy things easy and hard things possible. It is the first data visualization library that every Python Data Scientist encounters.

``````import matplotlib as mpl
import matplotlib.pyplot as plt
%config InlineBackend.figure_format = 'retina'
plt.rcParams["figure.figsize"] = [12, 4]
plt.style.use(['seaborn-darkgrid'])``````
``````import numpy as np
x = np.linspace(0, 10, 100)
plt.plot(x, np.sin(x), color='crimson', linestyle="-.")
plt.plot(x, np.cos(x));``````

Matlab Style Interface

``````# Create a figure to house the plots
plt.figure()

# Create a panel and add the first plot
plt.subplot(2, 1, 1)
plt.plot(x, np.sin(x))

# Create a panel and add the second plot
plt.subplot(2, 1, 2)
plt.plot(x, np.cos(x));``````

Object-Oriented Interface

``````# Create a grid of plots and an array of axis objects
fig, ax = plt.subplots(2)

# Use the plot() method to add the two plots
ax[0].plot(x, np.sin(x))
ax[1].plot(x, np.cos(x));``````
``````import pandas as pd
happiness_rankings_csv = "https://raw.githubusercontent.com/Nothingaholic/Python-Cheat-Sheet/master/matplotlib/happiness_rank.csv"
``````fig, ax = plt.subplots(figsize = (10,5))