Skip to main content
ClaudeWave
Slash Command413 repo starsupdated 5mo ago

visualize

The visualize command generates data visualizations for specified datasets using matplotlib, seaborn, plotly, and bokeh libraries through a visualization-specialist subagent. Use this command when you need to explore data patterns through charts like trends, distributions, correlations, or comparisons, with output saved to the ./visualizations/ directory as interactive dashboards and static images.

Install in Claude Code
Copy
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/liangdabiao/claude-data-analysis/HEAD/.claude/commands/visualize.md -o ~/.claude/commands/visualize.md
Then start a new Claude Code session; the slash command loads automatically.

visualize.md

# Data Visualization Command

Create comprehensive data visualizations for dataset `$1` with chart type `$2` using the visualization-specialist subagent.

## Context
- Dataset location: @data_storage/$1
- Chart type: $2 (all, trends, distribution, correlation, comparison, custom)
- Current working directory: !`pwd`
- Visualization output directory: ./visualizations/
- Available libraries: matplotlib, seaborn, plotly, bokeh

## Your Task

Use the visualization-specialist subagent to create informative visualizations:

### 1. Data Preparation
- Load and prepare the dataset
- Handle missing values and outliers
- Select appropriate variables for visualization
- Prepare data for different chart types

### 2. Visualization Planning
- Determine the best chart types for the data
- Plan color schemes and styling
- Consider the target audience and purpose
- Plan layout and composition

### 3. Chart Creation
- Create multiple complementary visualizations
- Ensure proper labeling and annotations
- Use appropriate scales and ranges
- Apply consistent styling and colors

### 4. Quality Assurance
- Test visualizations with different data scenarios
- Verify data accuracy in visualizations
- Check accessibility and readability
- Optimize for different screen sizes

## Chart Types

### All Visualizations
- Comprehensive dashboard with multiple chart types
- Overview of all key variables and relationships
- Executive summary visualizations
- Interactive exploration dashboard

### Trends
- Time series line charts
- Moving average plots
- Trend decomposition
- Seasonal analysis charts

### Distribution
- Histograms and density plots
- Box plots and violin plots
- Q-Q plots for normality
- Statistical distribution charts

### Correlation
- Correlation heatmaps
- Scatter plot matrices
- Pair plots
- Regression analysis plots

### Comparison
- Bar charts and column charts
- Grouped and stacked charts
- Small multiples
- Comparative analysis charts

### Custom
- User-specified custom visualizations
- Domain-specific charts
- Interactive dashboards
- Animated visualizations

## Expected Output

### Visualization Files
- `visualizations/dashboard_$1.html` - Interactive dashboard
- `visualizations/summary_$1.png` - Summary charts
- `visualizations/detailed_$1.pdf` - Detailed analysis charts
- `visualizations/charts_$1.py` - Reproducible code

### Documentation
- **Chart Descriptions**: Explanation of each visualization
- **Data Sources**: Documentation of data transformations
- **Interpretation Guide**: How to read and understand the charts
- **Customization Options**: How to modify and extend visualizations

## Technical Requirements

### File Formats
- **Static Images**: PNG (high-resolution), SVG (vector)
- **Interactive**: HTML with JavaScript (Plotly, D3.js)
- **Print**: PDF with high resolution
- **Code**: Python/R scripts for reproducibility

### Design Standards
- **Color Schemes**: Colorblind-friendly palettes
- **Typography**: Clear, readable fonts
- **Layout**: Responsive and well-organized
- **Accessibility**: WCAG compliant where possible

## Quality Assurance

### Validation Checks
- Verify data accuracy in all visualizations
- Test with different screen sizes and devices
- Check color accessibility
- Ensure proper labeling and annotations

### Performance
- Optimize file sizes for web display
- Ensure fast loading times
- Test interactivity and responsiveness
- Validate cross-browser compatibility

## Example Usage
```bash
/visualize user_behavior.csv all
/visualize sales_data.csv trends
/visualize customer_data.csv distribution
/visualize financial_data.csv correlation
/visualize performance_data.csv comparison
/visualize custom_data.csv custom
```

## Best Practices

### Design Principles
- **Data-Ink Ratio**: Maximize the ratio of data-ink to total ink
- **Chart Junk**: Eliminate non-data ink and decorative elements
- **Clarity**: Ensure the message is immediately understandable
- **Consistency**: Use consistent styling across all visualizations

### Data Integrity
- Validate data before visualization
- Handle missing values appropriately
- Use appropriate scales and ranges
- Document all data transformations

### User Experience
- Consider the target audience
- Provide clear labels and legends
- Include interactive features where helpful
- Offer multiple views of the same data

## Notes
- Dataset should be located in the data_storage/ directory
- Visualizations will be saved to visualizations/ directory
- Use Task tool to delegate to visualization-specialist subagent
- Consider using /analyze command first for data insights
- Interactive visualizations require web browser for viewing

## Integration with Other Commands
- Use after `/analyze` for data-driven visualizations
- Combine with `/report` for comprehensive analysis reports
- Follow with `/generate` for visualization code snippets
code-generatorSubagent

Expert code generation specialist for creating high-quality, production-ready analysis code in multiple programming languages. Use proactively for any code generation task requiring clean, efficient, and maintainable code for data analysis, machine learning, and visualization.

data-explorerSubagent

Advanced data exploration and analysis specialist for statistical analysis, pattern discovery, machine learning insights, and actionable business intelligence. Use proactively for any data analysis task requiring deep insights and comprehensive understanding.

hypothesis-generatorSubagent

Research hypothesis generation specialist for creating testable hypotheses, experimental designs, and research methodologies. Use proactively when data analysis suggests deeper investigation or when planning new research initiatives.

quality-assuranceSubagent

Data quality and validation specialist ensuring data integrity, analysis accuracy, and result reliability. Use proactively for any data validation, quality checks, or result verification tasks.

report-writerSubagent

Expert report writer specializing in comprehensive data analysis documentation, executive summaries, and technical documentation. Use proactively to create polished, professional reports.

visualization-specialistSubagent

Expert data visualization specialist for creating interactive, insightful, and publication-quality visualizations with advanced analytics integration and storytelling capabilities. Use proactively when data analysis would benefit from visual representation or when communicating complex insights to stakeholders.

analyzeSlash Command

Perform comprehensive data analysis on specified dataset

do-allSlash Command

自动化完成整个数据分析工作流程,从数据质量检查到最终报告生成