$npx -y skills add anthropics/knowledge-work-plugins --skill create-vizCreate publication-quality visualizations with Python. Use when turning query results or a DataFrame into a chart, selecting the right chart type for a trend or comparison, generating a plot for a report or presentation, or needing an interactive chart with hover and zoom.
| 1 | # /create-viz - Create Visualizations |
| 2 | |
| 3 | > If you see unfamiliar placeholders or need to check which tools are connected, see [CONNECTORS.md](../../CONNECTORS.md). |
| 4 | |
| 5 | Create publication-quality data visualizations using Python. Generates charts from data with best practices for clarity, accuracy, and design. |
| 6 | |
| 7 | ## Usage |
| 8 | |
| 9 | ``` |
| 10 | /create-viz <data source> [chart type] [additional instructions] |
| 11 | ``` |
| 12 | |
| 13 | ## Workflow |
| 14 | |
| 15 | ### 1. Understand the Request |
| 16 | |
| 17 | Determine: |
| 18 | |
| 19 | - **Data source**: Query results, pasted data, CSV/Excel file, or data to be queried |
| 20 | - **Chart type**: Explicitly requested or needs to be recommended |
| 21 | - **Purpose**: Exploration, presentation, report, dashboard component |
| 22 | - **Audience**: Technical team, executives, external stakeholders |
| 23 | |
| 24 | ### 2. Get the Data |
| 25 | |
| 26 | **If data warehouse is connected and data needs querying:** |
| 27 | 1. Write and execute the query |
| 28 | 2. Load results into a pandas DataFrame |
| 29 | |
| 30 | **If data is pasted or uploaded:** |
| 31 | 1. Parse the data into a pandas DataFrame |
| 32 | 2. Clean and prepare as needed (type conversions, null handling) |
| 33 | |
| 34 | **If data is from a previous analysis in the conversation:** |
| 35 | 1. Reference the existing data |
| 36 | |
| 37 | ### 3. Select Chart Type |
| 38 | |
| 39 | If the user didn't specify a chart type, recommend one based on the data and question: |
| 40 | |
| 41 | | Data Relationship | Recommended Chart | |
| 42 | |---|---| |
| 43 | | Trend over time | Line chart | |
| 44 | | Comparison across categories | Bar chart (horizontal if many categories) | |
| 45 | | Part-to-whole composition | Stacked bar or area chart (avoid pie charts unless <6 categories) | |
| 46 | | Distribution of values | Histogram or box plot | |
| 47 | | Correlation between two variables | Scatter plot | |
| 48 | | Two-variable comparison over time | Dual-axis line or grouped bar | |
| 49 | | Geographic data | Choropleth map | |
| 50 | | Ranking | Horizontal bar chart | |
| 51 | | Flow or process | Sankey diagram | |
| 52 | | Matrix of relationships | Heatmap | |
| 53 | |
| 54 | Explain the recommendation briefly if the user didn't specify. |
| 55 | |
| 56 | ### 4. Generate the Visualization |
| 57 | |
| 58 | Write Python code using one of these libraries based on the need: |
| 59 | |
| 60 | - **matplotlib + seaborn**: Best for static, publication-quality charts. Default choice. |
| 61 | - **plotly**: Best for interactive charts or when the user requests interactivity. |
| 62 | |
| 63 | **Code requirements:** |
| 64 | |
| 65 | ```python |
| 66 | import matplotlib.pyplot as plt |
| 67 | import seaborn as sns |
| 68 | import pandas as pd |
| 69 | |
| 70 | # Set professional style |
| 71 | plt.style.use('seaborn-v0_8-whitegrid') |
| 72 | sns.set_palette("husl") |
| 73 | |
| 74 | # Create figure with appropriate size |
| 75 | fig, ax = plt.subplots(figsize=(10, 6)) |
| 76 | |
| 77 | # [chart-specific code] |
| 78 | |
| 79 | # Always include: |
| 80 | ax.set_title('Clear, Descriptive Title', fontsize=14, fontweight='bold') |
| 81 | ax.set_xlabel('X-Axis Label', fontsize=11) |
| 82 | ax.set_ylabel('Y-Axis Label', fontsize=11) |
| 83 | |
| 84 | # Format numbers appropriately |
| 85 | # - Percentages: '45.2%' not '0.452' |
| 86 | # - Currency: '$1.2M' not '1200000' |
| 87 | # - Large numbers: '2.3K' or '1.5M' not '2300' or '1500000' |
| 88 | |
| 89 | # Remove chart junk |
| 90 | ax.spines['top'].set_visible(False) |
| 91 | ax.spines['right'].set_visible(False) |
| 92 | |
| 93 | plt.tight_layout() |
| 94 | plt.savefig('chart_name.png', dpi=150, bbox_inches='tight') |
| 95 | plt.show() |
| 96 | ``` |
| 97 | |
| 98 | ### 5. Apply Design Best Practices |
| 99 | |
| 100 | **Color:** |
| 101 | - Use a consistent, colorblind-friendly palette |
| 102 | - Use color meaningfully (not decoratively) |
| 103 | - Highlight the key data point or trend with a contrasting color |
| 104 | - Grey out less important reference data |
| 105 | |
| 106 | **Typography:** |
| 107 | - Descriptive title that states the insight, not just the metric (e.g., "Revenue grew 23% YoY" not "Revenue by Month") |
| 108 | - Readable axis labels (not rotated 90 degrees if avoidable) |
| 109 | - Data labels on key points when they add clarity |
| 110 | |
| 111 | **Layout:** |
| 112 | - Appropriate whitespace and margins |
| 113 | - Legend placement that doesn't obscure data |
| 114 | - Sorted categories by value (not alphabetically) unless there's a natural order |
| 115 | |
| 116 | **Accuracy:** |
| 117 | - Y-axis starts at zero for bar charts |
| 118 | - No misleading axis breaks without clear notation |
| 119 | - Consistent scales when comparing panels |
| 120 | - Appropriate precision (don't show 10 decimal places) |
| 121 | |
| 122 | ### 6. Save and Present |
| 123 | |
| 124 | 1. Save the chart as a PNG file with descriptive name |
| 125 | 2. Display the chart to the user |
| 126 | 3. Provide the code used so they can modify it |
| 127 | 4. Suggest variations (different chart type, different grouping, zoomed time range) |
| 128 | |
| 129 | ## Examples |
| 130 | |
| 131 | ``` |
| 132 | /create-viz Show monthly revenue for the last 12 months as a line chart with the trend highlighted |
| 133 | ``` |
| 134 | |
| 135 | ``` |
| 136 | /create-viz Here's our NPS data by product: [pastes data]. Create a horizontal bar chart ranking products by score. |
| 137 | ``` |
| 138 | |
| 139 | ``` |
| 140 | /create-viz Query the orders table and create a heatmap of order volume by day-of-week and hour |
| 141 | ``` |
| 142 | |
| 143 | ## Tips |
| 144 | |
| 145 | - If you want interactive charts (hover, zoom, filter), mention "interactive" and Claude will use plotly |
| 146 | - Specify "presentation" if you need larger fonts and higher contras |