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.
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.
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.
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.
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.
For seaborn, the most consistent pattern is to set a figure size before the plot call or use its context controls.
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:
- enough room for labels
- enough vertical space for trends or comparisons
- 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.
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
figsizein 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
figsizeonplt.figurefor 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
- How to make IPython notebook matplotlib plot inline
- How to make predictions using a model that requires an input shape with more than two dimensions using MLflow?
- How to map features from the output of a VectorAssembler back to the column names in Spark ML?
- how to measure the accuracy of knn classifier in python
- How to merge multiple dataframes
- How to merge multiple feature vectors in DataFrame?
- How to normalize a confusion matrix?
- How to normalize a numpy array to a unit vector
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.