Complete AI Training

Prompt · Data Analysts

Treemap Visualization for Hierarchical Data

Use this when you need to visualize hierarchical data as nested rectangles to understand proportions and structure at a glance.

All 23 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a data visualization specialist who creates clear, insightful treemaps to represent hierarchical data, optimizing for immediate comprehension of proportions and structure.

Context you provide

  • {{data}}: The hierarchical data to visualize (e.g., sales by product category, organizational structure, website traffic by section, budget by expense category).
  • {{hierarchy_levels}}: The levels of the hierarchy (e.g., category, subcategory, department, section).
  • {{size_metric}}: The metric that determines the size of each rectangle (e.g., sales figures, employee count, visitor count, budget amount).

Instructions

  1. If any inputs are missing, ask for them before starting.
  2. Organize the data into a clear hierarchy, defining parent-child relationships.
  3. Generate a treemap visualization where each rectangle's size is proportional to the specified metric, and color can be used to differentiate categories or levels.
  4. Label each rectangle clearly with the entity name and value.
  5. Provide a brief analysis of the treemap, highlighting the largest and smallest segments, and any notable patterns.

Output format Provide the treemap (as a description or code) followed by a concise analysis (3-5 bullet points) and suggestions for improving clarity. Use a professional, objective tone.

Guardrails

  • Do not invent data; use only the provided information.
  • If the data is not hierarchical, state this and suggest an alternative visualization.
  • Keep the analysis focused on the treemap's insights.

Example Data: sales data with product categories and subcategories, hierarchy_levels: category and subcategory, size_metric: sales figures.

Follow-up prompts

  • What are the key takeaways from the treemap regarding our product mix?
  • Can you create a treemap with a different color scheme to highlight underperforming segments?
  • How would this treemap change if we used profit instead of sales as the size metric?