Fundamentals & Architecture
What is the primary purpose of Matplotlib, and what are its two main interfaces?
What is the difference between pyplot and pylab in Matplotlib?
What is an 'Axes' object in Matplotlib, and why is it important?
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?
Explain the core components of Matplotlib's architecture, specifically differentiating between the Figure, Axes, Axis, and Artist objects.
In Matplotlib's layered architecture, what is the role of the 'Renderer' component?
Explain the grammar-of-graphics mental model (data, geometric mark, aesthetic mapping, scale, facet) and how Matplotlib and Seaborn compare to ggplot2/plotnine.
Describe the concept of 'everything is an artist' in Matplotlib and how it allows extensive customization of plots, even those generated by Seaborn.
How do you deal with API changes and deprecations across Matplotlib versions in a shared codebase?
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.
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?
Explain the purpose and utility of Seaborn's grid objects like FacetGrid, PairGrid, and JointGrid.
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?
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?
Explain the x, y, hue, size, style, col and row semantic mappings in Seaborn and the automatic legend and palette that come with them.
Why does Seaborn expect long/tidy input rather than wide form, and how do melt and pivot fit in as a pre-plotting step?
You passed an ax to a Seaborn call but it created its own figure — why does that happen and how do you fix it?
Seaborn's barplot and pointplot draw error bars by default — what do they represent, and why can a chart that silently aggregates mislead you?
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?
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?
What is the seaborn.objects interface, and how does it bring an explicit grammar of graphics to Seaborn?
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.
Why is a pie chart usually the wrong choice, and what alternatives better encode composition?
What is the difference between a grouped bar chart and a stacked bar chart, and when would you choose each?
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?
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?
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?
What is a hexbin plot or 2-D histogram, and when would you reach for it over a scatter plot?
What is the difference between a strip plot and a swarm plot, and what tradeoff does the swarm make?
When would you use imshow, and how do colormap and interpolation choices affect how an array or image is displayed?
When do 3-D plots hurt readability, and what 2-D alternative usually communicates the same data better?
How do histplot's stat parameter and the multiple/dodge/stack/fill options change what a histogram communicates?
How do bandwidth and cut affect a kdeplot, and what artifacts can a bad bandwidth introduce?
What do pairplot and jointplot show, and when would you use each?
Figures Subplots & Layout
Explain the difference between plt.figure() and plt.subplots(). When would you use each, and what does plt.subplots() return?
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?
Describe the purpose of GridSpec in Matplotlib. How does it offer more flexibility compared to plt.subplots() for arranging complex subplot layouts?
How would you display multiple plots in a single figure with their x-axes perfectly aligned and sharing the same limits for comparison?
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?
Why does a figure-level Seaborn function use height and aspect instead of figsize, and what does it return?
How do you create an inset or nested axes, and what communication purpose does an inset serve?
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?
Axes Ticks Spines & Annotations
How do you customize the appearance of ticks and tick labels on an axis in Matplotlib?
How do you add reference lines and shaded spans (e.g. axhline, axvspan) to a chart, and what communication purpose do they serve?
How do you handle crowded or overlapping date/categorical tick labels, and what options exist for rotating or formatting them?
What are spines in Matplotlib, and what does Seaborn's despine do and why?
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?
What is the difference between a tick locator and a tick formatter, and when would you customise each?
When would you use a logarithmic scale for an axis in Matplotlib, and what are its advantages?
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?
Styling Legends & Themes
What is the purpose of the alpha parameter in Matplotlib plotting functions?
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?
What are Seaborn's plotting contexts (paper, notebook, talk, poster), and how do they help size a figure for its medium?
What are rcParams and Matplotlib style sheets, and how can they be used to manage global plot aesthetics and ensure consistency across multiple figures?
How can you place a legend outside the main plot area in Matplotlib, and what considerations are important for its placement?
What is direct labelling, and when is it better than a legend?
Colour Colormaps & Palettes
Describe the differences between sequential, diverging, and qualitative colormaps, and when would you use each type?
Why is the 'jet' colormap often considered a poor choice?
How do you build a heatmap in Seaborn, and why should a correlation matrix use a diverging colormap centred at zero?
When should you use a colorbar instead of a discrete legend, and what does that tell you about the underlying variable?
Why should you not rely on colour alone to encode information, and how do you make a chart colour-blind safe?
What are the differences between Seaborn's palette types like husl/hls, cubehelix, and continuous versus categorical palettes, and when do you use each?
What does perceptual uniformity mean in the context of colormaps, and why is it important for effective data visualization?
What is colour normalization, and why would you use a log norm or a two-slope/centred norm on a colormap?
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?
Backends & Rendering
Why might a Matplotlib plot not display when running a script, and what common function call is often missed?
Why does plt.show() behave differently in a script versus a Jupyter notebook?
What are Matplotlib backends, and why are they important? Discuss the differences between interactive GUI backends and non-interactive backends like Agg.
Explain the purpose of matplotlib.use() and in what scenarios you might need to explicitly set the backend, especially for troubleshooting.
How would you decide between the inline and widget backends in a notebook, and why does that choice matter?
A figure comes out blank, empty or with clipped labels — how would you debug it?
How would you approach embedding a Matplotlib figure inside a web application?
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?
What do bbox_inches='tight' and transparent do in savefig, and when would you use them?
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?
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?
What does rasterizing a single layer inside an otherwise vector figure achieve?
How do you make figures reproducible and generate them automatically in a report or CI pipeline?
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?
How does FuncAnimation work at a high level, and when is an animated figure worth the added complexity?
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?
What is 'blitting' in the context of Matplotlib animations, and how does it improve performance for high-frame-rate visualizations?
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?
Why would you downsample or aggregate data before plotting rather than passing every point, and what is datashader's role at scale?
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?
What are the 'data-ink ratio' and 'chartjunk', and how do they guide you toward a cleaner chart?
What accessibility considerations — contrast, font size, colour-blind palettes, alt text — should a chart meet?
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?
How do the aspect ratio and axis range of a time-series plot affect how a trend is perceived?
Discuss the concept of visual integrity in data visualization and provide examples of how charts can unintentionally mislead an audience.
How can Gestalt principles of visual perception be applied to improve data visualizations created with Matplotlib/Seaborn?
When is a non-zero or truncated y-axis baseline legitimate, and when does it mislead the audience?
What is the 'lie factor', and how can area-versus-radius or aspect-ratio choices distort perceived quantity?
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?
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?
Discuss the distinction between exploratory and explanatory data visualization, and how does the intended audience influence your design choices for a chart?
When is a static Matplotlib figure the right deliverable versus an interactive library like Plotly, Bokeh or Altair?
Why should a chart title state the finding rather than just naming the variables?
What does the principle 'one chart, one message' mean, and how does it shape what you leave out?
What are the differences and tradeoffs between programming libraries like Matplotlib/Seaborn and BI tools like Tableau/Power BI for data visualization?
How do you use pre-attentive attributes and deliberate highlighting to direct a viewer's attention to what matters?
How do you sequence a set of figures into a narrative argument for a stakeholder presentation?