What is the primary purpose of Matplotlib, and what are its two main interfaces?
Junior
What is the difference between pyplot and pylab in Matplotlib?
Junior
What is an 'Axes' object in Matplotlib, and why is it important?
Junior
Explain the difference between Matplotlib's Pyplot API (state-based) and the Object-Oriented API. When would you choose one over the other, and why is the Object-Oriented style generally preferred for complex plots?
Mid
Explain the core components of Matplotlib's architecture, specifically differentiating between the Figure, Axes, Axis, and Artist objects.
Mid
In Matplotlib's layered architecture, what is the role of the 'Renderer' component?
Senior
Explain the grammar-of-graphics mental model (data, geometric mark, aesthetic mapping, scale, facet) and how Matplotlib and Seaborn compare to ggplot2/plotnine.
Senior
Describe the concept of 'everything is an artist' in Matplotlib and how it allows extensive customization of plots, even those generated by Seaborn.
Senior
How do you deal with API changes and deprecations across Matplotlib versions in a shared codebase?
Senior
Seaborn Fundamentals & Data Model
What is Seaborn, and how does it relate to Matplotlib? Explain their respective strengths and when you might choose one over the other, or both together.
Junior
Describe the fundamental difference between Seaborn's 'figure-level' and 'axes-level' plotting functions. What are the practical implications, especially regarding argument passing like the ax argument and the type of object returned?
Mid
Explain the purpose and utility of Seaborn's grid objects like FacetGrid, PairGrid, and JointGrid.
Mid
Explain the concept of 'tidy data' or 'long-form data' in the context of Seaborn. Why does Seaborn often expect data in this format, and what are the main principles of tidy data?
Mid
Seaborn is built on top of Matplotlib. How does this relationship allow for customization of Seaborn plots using Matplotlib functions, and what are some common Matplotlib customizations applied to Seaborn figures?
Mid
Explain the x, y, hue, size, style, col and row semantic mappings in Seaborn and the automatic legend and palette that come with them.
Mid
Why does Seaborn expect long/tidy input rather than wide form, and how do melt and pivot fit in as a pre-plotting step?
Mid
You passed an ax to a Seaborn call but it created its own figure — why does that happen and how do you fix it?
Mid
Seaborn's barplot and pointplot draw error bars by default — what do they represent, and why can a chart that silently aggregates mislead you?
Mid
When you use regplot or lmplot, what is the fitted line and the shaded band around it, and how should a reader interpret that band?
Mid
How do you manage global aesthetics and themes in Seaborn using set_theme, and how does this integrate with manipulating Matplotlib Axes objects for fine-grained control?
Senior
What is the seaborn.objects interface, and how does it bring an explicit grammar of graphics to Seaborn?
Senior
Plot Types & Selection
Explain the difference between a scatter plot and a line plot in Matplotlib, and when you would choose one over the other.
Junior
Why is a pie chart usually the wrong choice, and what alternatives better encode composition?
Junior
What is the difference between a grouped bar chart and a stacked bar chart, and when would you choose each?
Junior
For an explanatory chart built for an audience, how do you pick the encoding from the message you need to land — comparison, composition, distribution, relationship, or trend over time?
Mid
In Matplotlib and Seaborn, what do the whis, showfliers and notch parameters change about how a boxplot is drawn, and what does a notched box represent?
Mid
How is a violin plot constructed from a kernel density estimate, and what do Seaborn's inner options (box, quartile, stick, point) each draw inside it?
Mid
What is a hexbin plot or 2-D histogram, and when would you reach for it over a scatter plot?
Mid
What is the difference between a strip plot and a swarm plot, and what tradeoff does the swarm make?
Mid
When would you use imshow, and how do colormap and interpolation choices affect how an array or image is displayed?
Mid
When do 3-D plots hurt readability, and what 2-D alternative usually communicates the same data better?
Mid
How do histplot's stat parameter and the multiple/dodge/stack/fill options change what a histogram communicates?
Mid
How do bandwidth and cut affect a kdeplot, and what artifacts can a bad bandwidth introduce?
Mid
What do pairplot and jointplot show, and when would you use each?
Mid
Figures Subplots & Layout
Explain the difference between plt.figure() and plt.subplots(). When would you use each, and what does plt.subplots() return?
Junior
What are 'small multiples' or 'faceting' as a data visualization design pattern, and how can they be implemented using Matplotlib's subplot capabilities or Seaborn's grid functions?
Mid
Describe the purpose of GridSpec in Matplotlib. How does it offer more flexibility compared to plt.subplots() for arranging complex subplot layouts?
Mid
How would you display multiple plots in a single figure with their x-axes perfectly aligned and sharing the same limits for comparison?
Mid
Explain the concepts of constrained_layout and tight_layout in Matplotlib. What problems do they solve, and when might you still need manual spacing adjustments?
Mid
Why does a figure-level Seaborn function use height and aspect instead of figsize, and what does it return?
Mid
How do you create an inset or nested axes, and what communication purpose does an inset serve?
Mid
How would you assemble a small dashboard-style figure from a Matplotlib grid, and what are the limits of that approach versus a real dashboard tool?
Senior
Axes Ticks Spines & Annotations
How do you customize the appearance of ticks and tick labels on an axis in Matplotlib?
Junior
How do you add reference lines and shaded spans (e.g. axhline, axvspan) to a chart, and what communication purpose do they serve?
Junior
How do you handle crowded or overlapping date/categorical tick labels, and what options exist for rotating or formatting them?
Junior
What are spines in Matplotlib, and what does Seaborn's despine do and why?
Junior
How do you add text, annotations and arrows to point at a specific feature in a chart, and why is annotating the key point valuable?
Mid
What is the difference between a tick locator and a tick formatter, and when would you customise each?
Mid
When would you use a logarithmic scale for an axis in Matplotlib, and what are its advantages?
Mid
Explain the concept of 'twin axes' in Matplotlib. When might they be used, and what are the potential pitfalls or reasons why a dual y-axis can often mislead an audience?
Senior
Styling Legends & Themes
What is the purpose of the alpha parameter in Matplotlib plotting functions?
Junior
Discuss the importance of clear axis labels, titles, and legends in a chart, and how can you effectively manage legend placement when a legend might overlap with the plot area?
Junior
What are Seaborn's plotting contexts (paper, notebook, talk, poster), and how do they help size a figure for its medium?
Junior
What are rcParams and Matplotlib style sheets, and how can they be used to manage global plot aesthetics and ensure consistency across multiple figures?
Mid
How can you place a legend outside the main plot area in Matplotlib, and what considerations are important for its placement?
Mid
What is direct labelling, and when is it better than a legend?
Mid
Colour Colormaps & Palettes
Describe the differences between sequential, diverging, and qualitative colormaps, and when would you use each type?
Mid
Why is the 'jet' colormap often considered a poor choice?
Mid
How do you build a heatmap in Seaborn, and why should a correlation matrix use a diverging colormap centred at zero?
Mid
When should you use a colorbar instead of a discrete legend, and what does that tell you about the underlying variable?
Mid
Why should you not rely on colour alone to encode information, and how do you make a chart colour-blind safe?
Mid
What are the differences between Seaborn's palette types like husl/hls, cubehelix, and continuous versus categorical palettes, and when do you use each?
Mid
What does perceptual uniformity mean in the context of colormaps, and why is it important for effective data visualization?
Senior
What is colour normalization, and why would you use a log norm or a two-slope/centred norm on a colormap?
Senior
How do Seaborn's hue, size and style semantics map a variable onto a visual channel, and how do those channels rank for encoding ordered versus categorical data?
Senior
Backends & Rendering
Why might a Matplotlib plot not display when running a script, and what common function call is often missed?
Junior
Why does plt.show() behave differently in a script versus a Jupyter notebook?
Junior
What are Matplotlib backends, and why are they important? Discuss the differences between interactive GUI backends and non-interactive backends like Agg.
Mid
Explain the purpose of matplotlib.use() and in what scenarios you might need to explicitly set the backend, especially for troubleshooting.
Mid
How would you decide between the inline and widget backends in a notebook, and why does that choice matter?
Mid
A figure comes out blank, empty or with clipped labels — how would you debug it?
Mid
How would you approach embedding a Matplotlib figure inside a web application?
Senior
Exporting Figures
What is the difference between a figure's size and its DPI, and how do they interact when you save a raster image?
Junior
What do bbox_inches='tight' and transparent do in savefig, and when would you use them?
Junior
Describe the difference between raster and vector graphics when saving Matplotlib figures. When would you choose a vector format like SVG or PDF versus a raster format like PNG or JPEG?
Mid
When adapting a figure for different mediums like a notebook, slide deck, or printed report, what considerations would you make regarding size, DPI, and output format?
Mid
What does rasterizing a single layer inside an otherwise vector figure achieve?
Senior
How do you make figures reproducible and generate them automatically in a report or CI pipeline?
Senior
Performance & Large Datasets
For plotting very large datasets, what is 'overplotting,' and what techniques can be used to address it in Matplotlib such as alpha, jitter, hexbin, and 2D density?
Mid
How does FuncAnimation work at a high level, and when is an animated figure worth the added complexity?
Mid
Why can Matplotlib sometimes lead to memory leaks, especially when generating a large number of plots in a loop, and what are the key strategies to prevent them?
Senior
What is 'blitting' in the context of Matplotlib animations, and how does it improve performance for high-frame-rate visualizations?
Senior
When dealing with millions of data points, what are the performance implications for plotting, and what techniques can be employed to create efficient and readable visualizations?
Senior
Why would you downsample or aggregate data before plotting rather than passing every point, and what is datashader's role at scale?
Senior
Visual Integrity & Perception
When creating data visualizations, what are some key best practices you follow to ensure your charts are clear, informative, and not misleading to an audience?
Mid
What are the 'data-ink ratio' and 'chartjunk', and how do they guide you toward a cleaner chart?
Mid
What accessibility considerations — contrast, font size, colour-blind palettes, alt text — should a chart meet?
Mid
What can error bars on a chart represent — standard deviation, standard error, or a confidence interval — and why must you tell the audience which one it is?
Mid
How do the aspect ratio and axis range of a time-series plot affect how a trend is perceived?
Senior
Discuss the concept of visual integrity in data visualization and provide examples of how charts can unintentionally mislead an audience.
Senior
How can Gestalt principles of visual perception be applied to improve data visualizations created with Matplotlib/Seaborn?
Senior
When is a non-zero or truncated y-axis baseline legitimate, and when does it mislead the audience?
Senior
What is the 'lie factor', and how can area-versus-radius or aspect-ratio choices distort perceived quantity?
Senior
Data Storytelling & Communication
Explain why data visualization is important in analytics. Can you provide an example of how a well-designed visualization can convey insights that a table of numbers cannot?
Junior
How would you explain the importance of data storytelling to a non-technical stakeholder, and what are the key elements of a compelling data story?
Mid
Discuss the distinction between exploratory and explanatory data visualization, and how does the intended audience influence your design choices for a chart?
Mid
When is a static Matplotlib figure the right deliverable versus an interactive library like Plotly, Bokeh or Altair?
Mid
Why should a chart title state the finding rather than just naming the variables?
Mid
What does the principle 'one chart, one message' mean, and how does it shape what you leave out?
Mid
What are the differences and tradeoffs between programming libraries like Matplotlib/Seaborn and BI tools like Tableau/Power BI for data visualization?
Mid
How do you use pre-attentive attributes and deliberate highlighting to direct a viewer's attention to what matters?
Senior
How do you sequence a set of figures into a narrative argument for a stakeholder presentation?
Senior
Top 102 Matplotlib & Seaborn Interview Questions And Answers 2025 | TechPrep