You want to create a dashboard with 4 charts arranged in 2 rows and 2 columns using matplotlib. Which code snippet correctly creates this layout?
Think about how many rows and columns you need and how matplotlib returns axes in a 2D array for multiple rows and columns.
Using plt.subplots(2, 2) creates a 2x2 grid of axes. The axes are accessed by axs[row, column]. Other options create different layouts.
Which of the following is the best practice to improve readability in a dashboard layout?
Think about how grouping and spacing affect how easily someone can understand the dashboard.
Grouping related charts and using consistent spacing helps users quickly find and compare information. Overcrowding or too many colors can confuse users.
Given a sales table with columns Region, ProductCategory, and SalesAmount, which DAX measure calculates total sales per region ignoring any filters on ProductCategory?
Use a function that removes filters on ProductCategory but keeps filters on Region.
Using ALL(Sales[ProductCategory]) removes filters on ProductCategory only, so the measure sums sales ignoring product category filters but respects region filters.
What error will this code produce when creating a 3x1 dashboard layout?
fig, axs = plt.subplots(3, 1) axs[0, 0].plot(data1) axs[1, 0].plot(data2) axs[2, 0].plot(data3)
fig, axs = plt.subplots(3, 1) axs[0, 0].plot(data1) axs[1, 0].plot(data2) axs[2, 0].plot(data3)
Check how matplotlib returns axes when there is only one column.
When plt.subplots(3, 1) is used, axs is a 1D array of axes, so axs[0, 0] is invalid. You should use axs[0], axs[1], etc.
You are designing a dashboard that must look good on both desktop and mobile screens. Which approach best supports responsive layout using matplotlib?
Think about how to adjust layout dynamically rather than fixed sizes.
GridSpec allows flexible control of subplot sizes and positions, which can be adjusted programmatically to fit different screen sizes, supporting responsive design.