Jupyter
plots
visualization
inline-plot
data-science

How to make inline plots in Jupyter Notebook larger?

ML System Design practice on Codemia

Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.

Practice ML system design

Introduction

Inline plots in Jupyter can look too small because the default Matplotlib figure size is conservative. The fix is usually simple, but there are several levels at which you can control it: one plot, one notebook session, or all plots created by a library such as pandas or seaborn. Choosing the right level keeps notebooks readable without constantly repeating formatting code.

Change Size for One Plot

The most direct solution is to pass figsize when you create the figure.

python
1import matplotlib.pyplot as plt
2
3x = [1, 2, 3, 4]
4y = [1, 4, 9, 16]
5
6plt.figure(figsize=(10, 6))
7plt.plot(x, y)
8plt.title("Larger inline plot")
9plt.show()

This is the best option when only one or two charts need special sizing.

Change the Default Size for the Notebook Session

If many plots should use a larger default, update Matplotlib runtime configuration once.

python
1import matplotlib.pyplot as plt
2
3plt.rcParams["figure.figsize"] = (12, 7)
4plt.rcParams["figure.dpi"] = 110

After that, new plots in the notebook inherit those defaults unless a specific figure overrides them.

This is often the cleanest approach for exploratory notebooks because it keeps later cells short.

Improve Sharpness for Retina-Style Displays

Sometimes the problem is not only physical size but rendering quality. Jupyter can show higher-resolution inline plots so text and lines stay crisp.

python
%config InlineBackend.figure_format = "retina"

This does not change the logical dimensions of the figure, but it improves clarity on dense displays. It combines well with a larger figsize.

Make pandas and seaborn Plots Larger Too

pandas plotting is built on top of Matplotlib, so the same figure settings apply. You can also pass figsize directly when plotting from a DataFrame.

python
1import pandas as pd
2import matplotlib.pyplot as plt
3
4df = pd.DataFrame({
5    "month": ["Jan", "Feb", "Mar", "Apr"],
6    "sales": [120, 150, 170, 160],
7})
8
9ax = df.plot(x="month", y="sales", figsize=(9, 5), legend=False)
10ax.set_title("Sales by month")
11plt.show()

For seaborn, the most consistent pattern is to set a figure size before the plot call or use its context controls.

python
1import seaborn as sns
2import matplotlib.pyplot as plt
3
4plt.figure(figsize=(10, 6))
5sns.barplot(data=df, x="month", y="sales")
6plt.show()

Choose Width and Height Intentionally

Larger is not always better. A wide line chart may need 12, 4, while a categorical chart may read better at 8, 6. Think in terms of what the viewer needs:

  1. enough room for labels
  2. enough vertical space for trends or comparisons
  3. enough resolution for notebook screenshots or presentations

This matters more than memorizing one universal figure size.

Reset Defaults When a Notebook Gets Messy

Notebook sessions accumulate state. If plot sizes become inconsistent, reset Matplotlib defaults.

python
import matplotlib.pyplot as plt

plt.rcParams.update(plt.rcParamsDefault)

Then apply the size settings you actually want for the current analysis.

This matters in long notebooks, where cells executed hours apart may be relying on different plotting state than you remember. Resetting and reapplying deliberate defaults usually saves time.

Common Pitfalls

  • Changing figsize in one cell and forgetting that later plots inherit different defaults.
  • Increasing figure size without increasing resolution, leaving text blurry.
  • Using one oversized default for every chart type regardless of layout needs.
  • Assuming pandas or seaborn ignores Matplotlib sizing rules.
  • Debugging a plot layout issue that is really caused by long labels or notebook zoom level.

Summary

  • Use figsize on plt.figure for one-off larger plots.
  • Set plt.rcParams["figure.figsize"] for notebook-wide defaults.
  • Use the inline backend retina format for sharper rendering.
  • pandas and seaborn plots follow the same sizing principles because they sit on Matplotlib.
  • Pick dimensions based on the chart and audience, not one fixed magic number.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

ML System Design practice on Codemia

Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.

Practice ML system design

All Rights Reserved.