Aller au contenu
Skillpedia
Analyse et tableurs41k · #6901

creating-box-plot-insights

Ce qu’il fait

Cette skill crée un insight de type diagramme en boîte qui montre la dispersion d'une valeur numérique, comme sa médiane et ses quartiles. Elle s'adresse aux analystes qui veulent comparer la répartition des valeurs selon les dates ou les groupes.

Quand l’utiliser

  • ✓Quand vous voulez voir la dispersion d'une valeur numérique, comme la taille d'une commande ou le temps de chargement.
  • ✓Quand vous voulez comparer les médianes ou les quartiles selon les dates ou les groupes.
  • ✓Quand vous avez besoin d'un diagramme en boîte construit à partir de résultats SQL avec un regroupement personnalisé.

Lien du skill

https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/creating-box-plot-insights/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/creating-box-plot-insights/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Fais un diagramme en boîte du temps que prend le paiement chaque jour, pour que je voie la dispersion.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

La skill choisit soit un diagramme en boîte standard de tendances, soit un diagramme en boîte SQL, vérifie que la valeur est numérique, exécute la requête et enregistre l'insight. Elle relit ensuite l'insight pour confirmer qu'il est correct.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Creating box plot insights

Box plots need distribution data, not an already-aggregated average or total. Choose the simplest query type that can express the user's question.

Choose the query type

Use a standard product analytics box plot when all of these are true:

  • The source is an event, action, or warehouse table supported by Trends.
  • One numeric property contains the values to distribute.
  • The user wants the distribution over a normal time interval.

Use a SQL box plot when the user needs custom grouping, joins, derived values, or bespoke SQL. Read querying-posthog-data before writing HogQL, then use references/sql-examples.md as a starting point.

Do not use SQL only to reproduce a standard Trends query.

Standard product analytics box plot

  1. Identify the event or action and its numeric property. Confirm the property is numeric before saving.
  2. Build an InsightVizNode whose source is a TrendsQuery:
    • Set the series event or action.
    • Set math_property to the numeric property.
    • Set trendsFilter.display to BoxPlot.
    • Choose the date range and interval that match the question.
  3. Run the query with posthog:query-trends.
  4. If it returns distribution rows, save it with posthog:insight-create.
  5. Read it back with posthog:insight-get and confirm the property, interval, and display.

A box plot without a numeric math_property is invalid. Do not substitute event counts unless counts are the values the user wants to distribute.

SQL box plot

The SQL must return one pre-aggregated row for each X-axis and series pair. Calculate the summary in the database. Never calculate percentiles from the limited result rows in the client.

Required numeric roles:

  • minimum
  • 25th percentile
  • median
  • mean
  • 75th percentile
  • maximum

The easiest result shape uses these aliases:

x, series, min, p25, median, mean, p75, max

x and series are optional:

  • Set xAxisColumn to null for one overall distribution or one box per series.
  • Set seriesColumn to null for one series.

Validate the HogQL with posthog:execute-sql before saving. Check that:

  • Every required statistic is numeric.
  • min <= p25 <= median <= p75 <= max for every row.
  • The mean is between the minimum and maximum.
  • Each X-axis and series pair appears once.
  • There are at most 200 series and 10,000 X-axis by series cells.

Then save this shape with posthog:insight-create:

{
  "query": {
    "kind": "DataVisualizationNode",
    "source": {
      "kind": "HogQLQuery",
      "query": "<validated HogQL>"
    },
    "display": "BoxPlot",
    "chartSettings": {
      "boxPlot": {
        "xAxisColumn": "x",
        "seriesColumn": "series",
        "minColumn": "min",
        "p25Column": "p25",
        "medianColumn": "median",
        "meanColumn": "mean",
        "p75Column": "p75",
        "maxColumn": "max",
        "excludeOutliers": true
      }
    }
  }
}

Use the actual aliases when the query uses different names. Do not map the six statistics as six Y-axis series.

Verify the saved insight

  1. Read the saved insight with posthog:insight-get.
  2. Run it with posthog:insight-query.
  3. Confirm the result still has the expected columns and one row per box.
  4. Report the insight link, the numeric value being distributed, and the grouping choices.

If an individual row has a missing or invalid summary, PostHog omits that box while keeping valid boxes visible. Fix the SQL when omitted boxes are not expected.

Related skills

  • querying-posthog-data - required before authoring or changing the HogQL for a SQL box plot.
  • formatting-insight-axes - use when the value axis needs currency, duration, percentage, or other formatting.
  • building-a-dashboard - use when the box plot should be placed with other insights on a dashboard.
Questions fréquentes

Quand utiliser plutôt le SQL ?

Utilisez le SQL lorsque vous avez besoin d'un regroupement personnalisé, de jointures ou de valeurs dérivées. Une requête de tendances standard suffit pour une série temporelle classique.

Pourquoi a-t-elle besoin des valeurs brutes ?

Un diagramme en boîte montre la distribution, et non un total ou une moyenne. Il doit donc utiliser les valeurs numériques brutes.

Enregistre-t-elle l'insight ?

Oui. Une fois la requête renvoyé les lignes de distribution, l'insight est enregistré puis vérifié.

Détails

Description originale de l’auteur

Creates product analytics or SQL-backed box plot insights in PostHog. Use when a user asks to create, build, or save a box plot, visualize a numeric distribution, compare quartiles or medians across dates or groups, or turn SQL results into a box plot. Chooses between a standard Trends box plot and a SQL insight, validates the distribution data, saves the insight, and verifies it.

repo: PostHog/posthog

Popularité

Étoiles GitHub
41k
Position au classement
#6901
Licence
—
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires