Why are my plots not showing up in Jupyter Notebook?

Troubleshoot why your plots aren't showing in Jupyter Notebook with our comprehensive guide. Learn how to fix common issues and enhance your data visualization.

Hire Top Talent

Are you a candidate? Apply for jobs

Quick overview

The problem here is related to the inability to view graphical outputs (plots) in Jupyter Notebook, a web-based interactive computational environment where you can combine code execution, text, mathematics, plots and rich media. This could be due to several reasons such as incorrect usage of the plot function, not using the necessary libraries or modules for plotting, or not enabling inline viewing of plots in Jupyter Notebook. The term 'plots' refers to the graphical representation of data in Python programming, often used for data visualization.

Hire Top Talent now

Find top Data Science, Big Data, Machine Learning, and AI specialists in record time. Our active talent pool lets us expedite your quest for the perfect fit.

Share this guide

Why are my plots not showing up in Jupyter Notebook: Step-by-Step guide

Step 1: Check Your Code
Ensure that you have written the correct code for plotting. If you're using a library like Matplotlib, your code should look something like this:

import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()

The last line, plt.show(), is especially important. This command actually displays the plot. If you forget it, your plot will not appear.

Step 2: Check Your Jupyter Notebook Settings
Jupyter Notebook has a specific setting for Matplotlib. You need to tell Jupyter to display the plots in the notebook itself. You can do this by running the following line before your plot:

%matplotlib inline

This line only needs to be run once per notebook.

Step 3: Update Your Libraries
If your plots are still not showing up, it might be because your libraries are out of date. You can update them using pip:

pip install --upgrade matplotlib

Or, if you're using the Anaconda distribution of Python, you can use conda:

conda update matplotlib

Step 4: Restart Your Jupyter Notebook
Sometimes, Jupyter can get stuck in a bad state. Restarting it can often resolve the issue. You can do this by going to the "Kernel" menu and selecting "Restart". Then, try running your plot code again.

Step 5: Check for Errors
If your plots are still not showing up, check the output of your plot commands for errors. Python will typically print out a message if something goes wrong. This message can give you a clue as to what's going wrong.

Step 6: Ask for Help
If you've tried all of the above steps and your plots are still not showing up, it might be time to ask for help. You can post a question on a site like Stack Overflow, or ask a knowledgeable friend. When you ask, be sure to include your code and any error messages you're seeing. This will make it easier for others to help you.

Join over 100 startups and Fortune 500 companies that trust us

Hire Top Talent

Our Case Studies

CVS Health, a US leader with 300K+ employees, advances America’s health and pioneers AI in healthcare.

AstraZeneca, a global pharmaceutical company with 60K+ staff, prioritizes innovative medicines & access.

HCSC, a customer-owned insurer, is impacting 15M lives with a commitment to diversity and innovation.

Clara Analytics is a leading InsurTech company that provides AI-powered solutions to the insurance industry.

NeuroID solves the Digital Identity Crisis by transforming how businesses detect and monitor digital identities.

Toyota Research Institute advances AI and robotics for safer, eco-friendly, and accessible vehicles as a Toyota subsidiary.

Vectra AI is a leading cybersecurity company that uses AI to detect and respond to cyberattacks in real-time.

BaseHealth, an analytics firm, boosts revenues and outcomes for health systems with a unique AI platform.

Latest Blogs

Experience the Difference

Matching Quality

Submission-to-Interview Rate

65%

Submission-to-Offer Ratio

1:10

Speed and Scale

Kick-Off to First Submission

48 hr

Annual Data Hires per Client

100+

Diverse Talent

Diverse Talent Percentage

30%

Female Data Talent Placed

81