Installing and Running Jupyter Notebook: Complete Guide
To run the visualization code examples from our blog post, you'll need to set up Jupyter Notebook on your computer. Here's a step-by-step guide:
1. Install Python (If Not Already Installed)
Jupyter requires Python 3.6 or higher. Download from:
Verify installation:
python --version # or python3 --version
2. Install Jupyter Notebook
# Install using pip (Python package manager) pip install notebook # For Mac/Linux users, you might need: pip3 install notebook
3. Launch Jupyter Notebook
# Start the notebook server
jupyter notebook
This will automatically open your web browser to http://localhost:8888
Running the Visualization Code
-
Create a new notebook:
-
Click "New" > "Python 3" in the top right
-
-
Install required libraries (first cell):
!pip install matplotlib seaborn pandas numpy
-
Import libraries (new cell):
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np
-
Run visualization code (new cells):
# Example: Line plot months = ['Jan', 'Feb', 'Mar', 'Apr'] revenue = [12000, 18000, 15000, 22000] plt.figure(figsize=(10, 5)) plt.plot(months, revenue, marker='o', linestyle='--', color='#2c7bb6') plt.title('Monthly Revenue Growth', fontsize=14) plt.show()
-
Execute code:
-
PressÂ
Shift + Enter
 to run the current cell -
UseÂ
Ctrl + Enter
 to run and stay in the cell
-
Pro Tips for Jupyter
-
Keyboard Shortcuts:
-
a
: Insert cell above -
b
: Insert cell below -
dd
: Delete cell -
m
: Convert to Markdown -
Tab
: Auto-complete
-
-
Save Plots to Files:
plt.savefig('sales_trend.png', dpi=300, bbox_inches='tight')
-
View Available Functions:
# After importing, press Tab sns.<Tab>
-
Magic Commands:
%matplotlib inline # Show plots in notebook %load_ext autoreload # Auto-reload modules %autoreload 2
Alternative Installation Methods
Option 1: Install with Anaconda (Recommended for Beginners)
-
Download Anaconda
-
Follow installer instructions
-
Launch Jupyter from Anaconda Navigator
Option 2: Use Google Colab (No Installation)
-
Go to Google Colab
-
Create new notebook
-
Skip installation steps (libraries pre-installed)
Troubleshooting Common Issues
-
"Command not found: jupyter":
python -m pip install --upgrade pip python -m pip install jupyter
-
Plot Not Displaying:
Add this as first cell:%matplotlib inline
-
Kernel Not Starting:
pip install --upgrade ipykernel
-
Missing Libraries:
pip install matplotlib seaborn pandas numpy
Sample Workflow for Our Visualization Blog
# Cell 1: Setup %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np sns.set_style('whitegrid') # Set global style # Cell 2: Create sample data data = {'Region': ['North','North','South','South','East','East'], 'Category': ['Electronics','Clothing','Electronics','Clothing','Electronics','Clothing'], 'Sales': [120000, 80000, 95000, 75000, 110000, 85000]} df = pd.DataFrame(data) # Cell 3: Create visualization plt.figure(figsize=(10,6)) sns.barplot(x='Region', y='Sales', hue='Category', data=df, palette='viridis') plt.title('Regional Sales by Product Category', fontsize=16) plt.ylabel('Sales ($)', fontsize=12) plt.legend(title='Product Category') plt.savefig('regional_sales.png', dpi=300) # Save high-res version plt.show()
Now you're ready to create professional visualizations! For more advanced techniques, see our tutorial on Interactive Plotting with Plotly.