PlotSet LogoPlotSet

How to Create a Violin Plot

A step by step walkthrough for turning raw, row-level data into a published violin plot in PlotSet, including the bandwidth setting that decides whether the shape is real.

Environ 9 minutes

This guide covers how to create a violin plot in PlotSet, starting from a spreadsheet of individual observations and ending with a published chart you can embed or export. It is not five clicks: the one setting that actually matters, bandwidth, has no correct default, so you will nudge it and look at the result rather than accept whatever PlotSet picks first.

Nine minutes, roughly, if your data is already one row per observation with a group column and a value column. Pulling that from a report that only has group averages adds five more, because you'll need to go back to the source and get the underlying rows. A violin built from averages isn't a violin, it's a flat line pretending to be one.

Les données dont vous avez besoin

Two columns, one row per observation: a group label first, a numeric value second. Raw values, not pre-aggregated averages, one header row.

Exemple de CSV
WarehouseFulfillmentHours
Chicago4.2
Chicago4.8
Chicago3.9
Chicago9.1
Chicago4.5
Chicago4.1
Dallas6.0
Dallas6.3
Dallas5.8
Dallas6.1
Dallas12.4
Dallas6.5
Reno3.0
Reno3.2
Reno2.9
Reno3.4
Reno3.1
Reno7.8
Remarques

Every observation needs its own row. If your source file already has one row per group with an average fulfillment time, there is nothing left to draw a density from: go back and pull the order-level data instead.

Keep the group column as text. A warehouse code like "04" will still group correctly, but check the axis order once it is uploaded in case it got sorted numerically instead of the way you intended.

A blank cell in the value column is dropped from that group's density rather than treated as zero, which is the right behavior but can explain a row count that does not match your source file.

Uneven group sizes are fine. Chicago having forty rows and Reno having twelve does not break anything here, unlike some chart types that expect equal counts.

Les étapes

Le parcours exact dans PlotSet, d'un modèle vierge à un graphique terminé.

  1. 01

    Open the Violin Plot template

    From the PlotSet dashboard, start a new project and choose the Violin Plot template. It loads with sample data already in place, so you can see the two-column shape PlotSet expects before you touch your own file.

    Le sélecteur de modèles de PlotSet : les catégories de graphiques listées à gauche, la grille 'Bar Charts' ouverte et la carte du modèle 'Bar Chart' affichant son bouton 'Select'.
    Chaque guide commence ici. Choisissez la catégorie, puis le modèle : c'est la même grille quel que soit le type de graphique visé.
  2. 02

    Shape your sheet into observations, not summaries

    Put the group label in the first column and the raw numeric value in the second, one row per observation. If your export is a pivot table with an average per group, that is the wrong shape: pull the underlying rows from wherever the pivot came from.

  3. 03

    Import your data or connect a sheet

    Use the data panel to import a CSV or .xlsx file, paste rows directly from a spreadsheet, or connect a Google Sheet if the underlying numbers change regularly. PlotSet reads the first row as headers automatically.

    La vue données de l'éditeur PlotSet : une grille de tableur dont les colonnes 'Name', 'Value' et 'Region' sont remplies de chiffres par province canadienne, à côté du panneau 'Data' qui propose l'import d'un CSV, 'Magic Import' et la synchronisation d'une Google Sheet.
    La vue données, ici sur un projet de graphique en barres. Importez un CSV, extrayez les chiffres d'une image avec 'Magic Import' ou synchronisez une Google Sheet. Le panneau est identique pour tous les types de graphique.
  4. 04

    Map the group and value columns

    Confirm which column feeds the category axis and which feeds the density curve. This is usually right on the first try when your headers say what they mean, but double-check it if your sheet carries extra columns PlotSet had to guess between.

    Le panneau de données de PlotSet avec les associations de colonnes mises en évidence : 'Label/time' affecté à la colonne A, 'Values' à la colonne B et 'Filter/color' à la colonne C, et le bouton 'Auto Binding' juste en dessous.
    Les associations déterminent quelle colonne devient l'étiquette, laquelle fournit les valeurs et laquelle pilote la couleur. 'Auto Binding' les devine à partir de vos en-têtes : vérifiez-les plutôt que de les tenir pour acquises.
  5. 05

    Adjust the bandwidth and watch what changes

    Move the bandwidth slider up and down before settling on a value. Too high and two real peaks merge into one soft hump; too low and the curve gets bumpy from noise alone. Keep whichever shape survives a small nudge in both directions.

  6. 06

    Sort the groups by median

    Switch the group order from alphabetical to sorted by median value. Reno, Chicago, Dallas in that order tells the reader something; Chicago, Dallas, Reno alphabetically does not.

  7. 07

    Turn on the inner box and pick your colors

    Enable the inner box or median marker so a reader who wants the exact number does not have to eyeball the widest point of the curve. One color per group is standard; save a second, contrasting color for a group you specifically want to call out.

    L'éditeur PlotSet sur l'onglet 'Preview' : un graphique Violin Plot terminé sur le canevas, avec le panneau de réglages entouré en rouge le long du bord droit.
    L'onglet 'Preview' pour un graphique Violin Plot. Tous les réglages de style se trouvent dans le panneau entouré en rouge : apparence, en-tête, pied de page et les options propres à ce type de graphique, chacun dans un onglet distinct.
  8. 08

    Wrap up: publish, embed or export

    Publish for a live, interactive chart with a tooltip on every group, grab the embed code to drop it into a page, or export a PNG, SVG or PDF if you need a static image for a deck.

Partez du modèle Violin Plot avec des données d'exemple déjà chargées, puis remplacez-les par les vôtres.

Ouvrir le modèle

Publier, intégrer ou exporter

La dernière ligne droite est la même pour tous les types de graphique : 'Share' transforme le graphique en lien public actif et en code d'intégration, 'Export' l'enregistre sous forme de fichier statique.

Share : lien public et code d'intégration

Activer le code d'intégration et le lien public revient à publier le graphique. Le lien peut être envoyé à qui vous voulez sans risque, et le code d'intégration s'insère dans n'importe quelle page sous la forme d'une iframe qui conserve les infobulles au survol et l'interactivité. Si vous modifiez le graphique par la suite, cliquez sur 'Recreate' pour répercuter ces changements sur le lien comme sur le code.

La barre d'outils de l'éditeur PlotSet avec le bouton 'Share' mis en évidence, juste à côté du bouton 'Export'.
C'est par 'Share' qu'un graphique terminé devient un lien public et un code d'intégration.
La fenêtre 'Share' de PlotSet : l'interrupteur qui active le code d'intégration et le lien public, les boutons 'Link', 'Embed', Facebook, Reddit, Twitter, LinkedIn et Email, et le lien public du graphique avec un bouton 'Copy'.
Activez le code d'intégration et le lien public, puis copiez le lien ou récupérez l'iframe. 'Recreate' répercute vos modifications ultérieures sur le lien et le code déjà partagés.

Export : SVG, PNG ou JPG

Le bouton 'Export' génère une copie statique à la taille dont vous avez besoin. Le SVG reste net à toutes les échelles et peut encore être modifié dans un outil de design ; PNG et JPG sont les choix sûrs pour les présentations et les documents. C'est le multiplicateur d'échelle qui vous donne une image nette sur un écran retina.

La barre d'outils de l'éditeur PlotSet avec le bouton 'Export' mis en évidence.
C'est par 'Export' que vous obtenez un fichier statique pour une diapositive ou un rapport.
La fenêtre 'Export chart' de PlotSet : un sélecteur d'échelle réglé sur 2x, les champs de largeur et de hauteur à 1000 × 600, et le menu des formats ouvert, affichant SVG, PNG et JPG.
Le SVG reste net à toutes les tailles et modifiable dans un outil de design ; PNG et JPG sont les choix sûrs pour une présentation. Réglez l'échelle avant d'exporter pour que l'image soit nette sur un écran retina.

Conseils de style pour un Violin Plot

Trim the curve if your values are bounded

If your value column cannot go below zero, hours worked, order counts, percentages, turn on trimming so the density stops at the observed minimum instead of smoothing past it into negative territory that cannot exist.

Keep the inner summary on by default

A bare outline looks cleaner in a screenshot but leaves the reader guessing at the median. The inner box costs almost nothing visually and answers the first question anyone asks about a distribution: where is the middle.

One color family, not one color per group by default

Color coding every violin a different hue implies the groups are categorically different in some way beyond the axis label. A single color, or a light gradient across an ordered axis, keeps the reader's attention on shape rather than on a legend.

Widen the chart before you narrow the bandwidth

A violin squeezed into a narrow column looks noisier than the same data drawn wide, because horizontal detail gets compressed along with the shape. Give the chart more width first, then revisit the bandwidth: you may not need to smooth as hard as you thought.

Erreurs courantes en créant un Violin Plot

Every violin comes out as a thin, flat sliver

This is almost always pre-aggregated data: one row per group with an average, instead of one row per observation. Check your source file for the raw rows the average was calculated from and upload those instead.

Two groups that should look different look identical

The bandwidth is probably set too high for the amount of data you have, smoothing away the real differences between groups. Lower it step by step until the shapes diverge, then stop at the point where they stop changing.

The curve extends below zero on a value that cannot be negative

Kernel density smoothing does not know your values are bounded, so it draws density past the edge unless told otherwise. Turn on trimming to the observed range, or note in a caption that the tails past the boundary are a smoothing artifact.

En savoir plus sur le Violin Plot

Vous n'êtes pas sûr que le Violin Plot soit le bon choix ? Découvrez ce que c'est, quand l'utiliser et quand l'éviter.

À propos du Violin Plot

Violin Plot : questions fréquentes

Aim for at least fifty observations per group before trusting the shape, and a few hundred before it is genuinely stable. PlotSet will still draw a violin from fewer rows, but the curve mostly reflects the bandwidth setting rather than the data at that size.

Créez votre Violin Plot maintenant

Gratuit pour commencer avec plus de 300 modèles. Aucune carte bancaire requise.