Skip to main content
data intermediate

Create Data Heatmap Visualization

Generate comprehensive heatmap visualizations with code, styling, and insights. Perfect for data analysis and presentation needs.

Works with: chatgptclaudegemini

Prompt Template

You are a data visualization expert specializing in heatmap creation. I need you to create a comprehensive heatmap visualization for my dataset. Dataset Details: - Data type: [DATA_TYPE] - Dataset size: [DATASET_SIZE] - Key variables/columns: [KEY_VARIABLES] - Primary analysis goal: [ANALYSIS_GOAL] Specific Requirements: - Visualization library: [LIBRARY_PREFERENCE] - Color scheme preference: [COLOR_SCHEME] - Output format: [OUTPUT_FORMAT] Please provide: 1. Complete Python code for generating the heatmap 2. Data preprocessing steps if needed 3. Customization options for colors, labels, and styling 4. Code comments explaining each major step 5. Instructions for interpreting the heatmap results 6. Suggestions for improving readability (font sizes, rotation, etc.) 7. Export options for different file formats 8. Brief analysis of what patterns or insights the heatmap might reveal Ensure the code is production-ready, well-documented, and includes error handling. Also provide alternative styling options and explain when different heatmap types (correlation, frequency, etc.) would be most appropriate for the given data.

Variables to Customize

[DATA_TYPE]

Type of data being visualized

Example: Sales performance data by region and month

[DATASET_SIZE]

Approximate size and dimensions of dataset

Example: 12 months × 8 regions (96 data points)

[KEY_VARIABLES]

Main columns or variables in the dataset

Example: Month, Region, Sales_Amount, Units_Sold

[ANALYSIS_GOAL]

What insights you want to discover

Example: Identify seasonal patterns and high-performing regions

[LIBRARY_PREFERENCE]

Preferred Python visualization library

Example: Seaborn with matplotlib

[COLOR_SCHEME]

Desired color palette or scheme

Example: Blues colormap for professional presentation

[OUTPUT_FORMAT]

Required output format for the visualization

Example: High-resolution PNG for presentation slides

Example Output

```python import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Load and prepare sales data df = pd.read_csv('sales_data.csv') pivot_data = df.pivot_table(values='Sales_Amount', index='Region', columns='Month', aggfunc='sum') # Create heatmap plt.figure(figsize=(12, 8)) sns.heatmap(pivot_data, annot=True, fmt='.0f', cmap='Blues', cbar_kws={'label': 'Sales Amount ($)'}, linewidths=0.5) plt.title('Sales Performance Heatmap by Region and Month', fontsize=16, pad=20) plt.xlabel('Month', fontsize=12) plt.ylabel('Region', fontsize=12) plt.xticks(rotation=45) plt.tight_layout() # Save high-resolution output plt.savefig('sales_heatmap.png', dpi=300, bbox_inches='tight') plt.show() ``` **Interpretation Guide:** - Darker blue cells indicate higher sales performance - Look for vertical patterns (seasonal trends) and horizontal patterns (regional consistency) - White/light areas may indicate underperformance or missing data **Customization Options:** - Alternative colormaps: 'RdYlBu_r', 'viridis', 'plasma' - Add correlation coefficients with `corrwith()` method - Implement clustering to group similar regions/months

Pro Tips for Best Results

  • Always normalize data when comparing different scales or units to avoid misleading visualizations
  • Use diverging colormaps (RdBu, RdYlGn) when your data has a meaningful center point like zero
  • Add annotations sparingly - too many numbers can clutter the visualization and reduce impact
  • Consider data ordering - clustering similar rows/columns together reveals patterns more clearly
  • Test different aspect ratios - square cells work best for correlation matrices, rectangles for time series

Tags

Want 500+ Expert Prompts?

Get the Premium Prompt Pack — organized, tested, and ready to use.

Get it for $29

Related Prompts You Might Like