chart-generator
Generate charts and visualizations from data using various charting libraries and formats.
What this skill does
# Chart Generator Skill
Generate charts and visualizations from data using various charting libraries and formats.
## Instructions
You are a data visualization expert. When invoked:
1. **Analyze Data**:
- Understand data structure and types
- Identify appropriate chart types
- Detect data patterns and trends
- Calculate aggregations and statistics
- Determine visualization goals
2. **Generate Charts**:
- Create bar, line, pie, scatter plots
- Generate heatmaps and tree maps
- Create histograms and box plots
- Build time series visualizations
- Design multi-dimensional charts
3. **Style and Customize**:
- Apply color schemes and themes
- Add labels, legends, and annotations
- Format axes and gridlines
- Customize tooltips and interactions
- Ensure accessibility and readability
4. **Export and Embed**:
- Save as PNG, SVG, PDF
- Generate interactive HTML charts
- Embed in markdown reports
- Create chart APIs
- Support responsive design
## Usage Examples
```
@chart-generator data.csv --type bar
@chart-generator --line --time-series
@chart-generator --pie --group-by category
@chart-generator --scatter x:age y:income
@chart-generator --heatmap --correlation
@chart-generator --interactive --html
```
## Chart Types and Use Cases
### When to Use Each Chart Type
| Chart Type | Best For | Example Use Case |
|------------|----------|------------------|
| Bar Chart | Comparing categories | Sales by product |
| Line Chart | Trends over time | Revenue over months |
| Pie Chart | Part-to-whole relationships | Market share |
| Scatter Plot | Relationships between variables | Height vs Weight |
| Histogram | Distribution of values | Age distribution |
| Box Plot | Statistical distribution | Salary ranges by department |
| Heatmap | Matrix data, correlations | Feature correlations |
| Area Chart | Cumulative trends | Stacked revenue streams |
| Bubble Chart | 3-dimensional data | Sales vs Profit vs Market Share |
| Treemap | Hierarchical data | Disk space usage |
## Python - Matplotlib
```python
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def create_bar_chart(data, x_col, y_col, title='Bar Chart', output='chart.png'):
"""
Create a bar chart
"""
plt.figure(figsize=(10, 6))
if isinstance(data, pd.DataFrame):
x = data[x_col]
y = data[y_col]
else:
x = data['labels']
y = data['values']
bars = plt.bar(x, y, color='steelblue', alpha=0.8)
# Add value labels on bars
for bar in bars:
height = bar.get_height()
plt.text(bar.get_x() + bar.get_width()/2., height,
f'{height:.1f}',
ha='center', va='bottom')
plt.title(title, fontsize=16, fontweight='bold')
plt.xlabel(x_col if isinstance(data, pd.DataFrame) else 'Category', fontsize=12)
plt.ylabel(y_col if isinstance(data, pd.DataFrame) else 'Value', fontsize=12)
plt.xticks(rotation=45, ha='right')
plt.grid(axis='y', alpha=0.3)
plt.tight_layout()
plt.savefig(output, dpi=300, bbox_inches='tight')
plt.close()
return output
def create_line_chart(data, x_col, y_col, title='Line Chart', output='chart.png'):
"""
Create a line chart
"""
plt.figure(figsize=(12, 6))
if isinstance(data, pd.DataFrame):
x = data[x_col]
y = data[y_col]
else:
x = data['x']
y = data['y']
plt.plot(x, y, marker='o', linewidth=2, markersize=6, color='steelblue')
# Add grid
plt.grid(True, alpha=0.3)
plt.title(title, fontsize=16, fontweight='bold')
plt.xlabel(x_col if isinstance(data, pd.DataFrame) else 'X', fontsize=12)
plt.ylabel(y_col if isinstance(data, pd.DataFrame) else 'Y', fontsize=12)
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.savefig(output, dpi=300, bbox_inches='tight')
plt.close()
return output
def create_pie_chart(data, labels_col, values_col, title='Pie Chart', output='chart.png'):
"""
Create a pie chart
"""
plt.figure(figsize=(10, 8))
if isinstance(data, pd.DataFrame):
labels = data[labels_col]
values = data[values_col]
else:
labels = data['labels']
values = data['values']
# Create color palette
colors = plt.cm.Set3(np.linspace(0, 1, len(labels)))
# Create pie chart
wedges, texts, autotexts = plt.pie(
values,
labels=labels,
autopct='%1.1f%%',
startangle=90,
colors=colors,
explode=[0.05] * len(labels) # Slightly separate slices
)
# Style percentage text
for autotext in autotexts:
autotext.set_color('white')
autotext.set_fontweight('bold')
autotext.set_fontsize(10)
plt.title(title, fontsize=16, fontweight='bold')
plt.axis('equal')
plt.tight_layout()
plt.savefig(output, dpi=300, bbox_inches='tight')
plt.close()
return output
def create_scatter_plot(data, x_col, y_col, color_col=None, size_col=None,
title='Scatter Plot', output='chart.png'):
"""
Create a scatter plot
"""
plt.figure(figsize=(10, 8))
if isinstance(data, pd.DataFrame):
x = data[x_col]
y = data[y_col]
c = data[color_col] if color_col else None
s = data[size_col] if size_col else 50
else:
x = data['x']
y = data['y']
c = None
s = 50
scatter = plt.scatter(x, y, c=c, s=s, alpha=0.6, cmap='viridis')
if color_col:
plt.colorbar(scatter, label=color_col)
# Add trend line
z = np.polyfit(x, y, 1)
p = np.poly1d(z)
plt.plot(x, p(x), "r--", alpha=0.8, label='Trend')
plt.title(title, fontsize=16, fontweight='bold')
plt.xlabel(x_col if isinstance(data, pd.DataFrame) else 'X', fontsize=12)
plt.ylabel(y_col if isinstance(data, pd.DataFrame) else 'Y', fontsize=12)
plt.grid(True, alpha=0.3)
plt.legend()
plt.tight_layout()
plt.savefig(output, dpi=300, bbox_inches='tight')
plt.close()
return output
def create_histogram(data, column, bins=30, title='Histogram', output='chart.png'):
"""
Create a histogram
"""
plt.figure(figsize=(10, 6))
if isinstance(data, pd.DataFrame):
values = data[column]
else:
values = data
n, bins, patches = plt.hist(values, bins=bins, color='steelblue',
alpha=0.7, edgecolor='black')
# Add mean line
mean_val = np.mean(values)
plt.axvline(mean_val, color='red', linestyle='dashed', linewidth=2,
label=f'Mean: {mean_val:.2f}')
# Add median line
median_val = np.median(values)
plt.axvline(median_val, color='green', linestyle='dashed', linewidth=2,
label=f'Median: {median_val:.2f}')
plt.title(title, fontsize=16, fontweight='bold')
plt.xlabel(column if isinstance(data, pd.DataFrame) else 'Value', fontsize=12)
plt.ylabel('Frequency', fontsize=12)
plt.legend()
plt.grid(axis='y', alpha=0.3)
plt.tight_layout()
plt.savefig(output, dpi=300, bbox_inches='tight')
plt.close()
return output
def create_box_plot(data, columns, title='Box Plot', output='chart.png'):
"""
Create a box plot
"""
plt.figure(figsize=(10, 6))
if isinstance(data, pd.DataFrame):
data_to_plot = [data[col].dropna() for col in columns]
labels = columns
else:
data_to_plot = data
labels = [f'Group {i+1}' for i in range(len(data))]
bp = plt.boxplot(data_to_plot, labels=labels, patch_artist=True)
# Color boxes
for patch in bp['boxes']:
patch.set_facecolor('lightblue')
patch.set_alpha(0.7)
plt.title(title, fontsize=16, fontweight='bold')
plt.ylabel('Value', fontsize=12)
plt.grid(axis='y', alpha=0.3)
plt.xticks(rotation=45, ha='right')
plt.tight_layout()
plt.savefig(output, dpi=300, bbox_inches='tight')
plt.close()
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.