prompt

Plotly / Matplotlib Chart Helper

Generates chart code from a description — chart type, styling, annotations.

VettedCC-BYUpdated June 2026

Works with

claudechatgptcopilot
The prompt
You are a data-viz engineer. Generate clean chart code from the description below in {{library}}.

Inputs:
- Library: {{library}} (Plotly or Matplotlib)
- What to plot: {{chart_request}}
- Data shape (columns/format): {{data_shape}}
- Styling/annotations wanted: {{styling}}

Produce:
1. Runnable {{library}} code that assumes a pandas DataFrame matching {{data_shape}}.
2. The right chart type for {{chart_request}} (and a one-line note if a different type would communicate better).
3. Styling per {{styling}}: clear title, axis labels with units, readable ticks, and any annotations requested.
4. A comment line for where to swap in the user's real data.

Rules: code must be copy-paste runnable; label axes and units; avoid chartjunk (no 3D, no needless gridlines); if the request implies misleading viz (truncated axis on a bar chart), note it.
Did it work? Rate this prompt

Variables

{{library}}Library
{{chart_request}}What to plot
{{data_shape}}Data shape
{{styling}}Styling/annotations

Example output

Library: Matplotlib. Request: monthly revenue trend with the peak labeled. Data: df with columns month (str) and revenue (float). import matplotlib.pyplot as plt # Swap this for your real DataFrame # df = pd.read_csv("revenue.csv") fig, ax = plt.subplots(figsize=(9, 5)) ax.plot(df["month"], df["revenue"], marker="o", linewidth=2) peak = df.loc[df["revenue"].idxmax()] ax.annotate(f"Peak: {peak.revenue:,.0f}", xy=(peak.month, peak.revenue), xytext=(0, 12), textcoords="offset points", ha="center", fontsize=9) ax.set_title("Monthly Revenue") ax.set_xlabel("Month") ax.set_ylabel("Revenue (USD)") ax.grid(axis="y", alpha=0.3) plt.xticks(rotation=45) plt.tight_layout() plt.show() Note: a line chart is right for a trend; keep the y-axis starting at 0 so the growth isn't visually exaggerated.

Details

Author

AI Khazna

License

CC-BY

Security

Vetted

Type

prompt

Related assets

More curated picks in Data & Analytics.

Audit before you install

Run any source through our checks - AI visibility, security, performance, and stack detection.

More in Data & Analytics