Violin Plot

Violin Plot is a combination of a box plot and density plot that shows the distribution shape of the data.

Step 1

Try an Example

Before getting started with your own dataset, you can check out an example. First, select the 'Type' menu. Hovering the mouse over the chart type icon will display three options: 1) Charts like this by Chart Studio users, 2) View tutorials on this chart type, and, 3) See a basic example.

Clicking the 'See a basic example' option will show what a sample chart looks like after adding data and editing with the style. You'll also see what labels and style attributes were selected for this specific chart, as well as the end result.

Example after

You can also use the data featured in this tutorial by clicking on 'Open This Data in Chart Studio' on the left-hand side. It'll open in Chart Studio.

Step 2

Add Your Data to Chart Studio

Head to Chart Studio and add your data. You have the option of typing directly in the grid, uploading your file, or entering a URL of an online dataset. Chart Studio accepts .xls, .xlsx, or .csv files. For more information on how to enter your data, see this tutorial.

Step 3

Create a Chart

After adding data, go to the 'Traces' section under the 'Structure' menu on the left-hand side. Choose the 'Type' of trace, then choose 'Violin' under 'Distributions' chart type.

Choose chart

Next, select the 'X'and 'Y' values from the dropdown menus. This will add a violin trace to the chart as seen below.

Adding X Y Z values

To add more traces to the chart, click on the '+ Trace' button at the top right corner of the panel in the 'Traces' section under the 'Structure' menu. Add as many traces as needed, until the plot is complete! This is what the plot looks like after adding all the traces.

Add All

The property 'Axes to Use' under each trace panel allows you to choose the desired 'X Axis' and 'Y Axis' from the dropdown menus to be used as reference axis for the respective trace. If the reference axis is not available in the dropdown, click on the '+' button next to the dropdwon to add a new reference axis associated with the trace.

Add axis

Step 4

Style a Chart

The 'Style' menu displays many options to modify characteristics of the overall chart layout or the individual traces. To see more options about styling the chart, visit the style and layout section of the Chart Studio documentation.

Use the 'General' section under the 'Style' menu to change the general style properties such as plot background color, margin color and font sytlings, the layout properties, the modebar and interactive settings.

To set the plot title, type the title text within the textbox provided under the 'Title' property in the 'General' section.

Plot Title

Another approach is to click and then enter the title directly on the plot interface. The same can be done for the axes title and the legends.

Type directly title

To change the properties specific to the traces in the plot such trace name, color, etc., go to the 'Traces' section under the 'Style' menu.

Trace Properties

Use the 'Points' property to show/hide/modify the marker points associated with the violins.

Violin Points

To set the size and positioning of the violins, use the 'Violin Size and Spacing' property.

To display only the positive side of the violins, set the attribute 'Visible Sides' to 'Positive' and similarly choose 'Negative' to display the negative side of the violins.

Violin Sides

To display box traces within the violins, click 'Show' under the 'Box' property.

Box trace

Use the 'Axis' section under the 'Style' menu to change the axis properties such as axes title, lines and tick properties.

To set custom range for the axes click on the 'Custom' button under the 'Range' property.

Axis Range

Step 5

Save and Share

To save the plot click the 'Save' button on the left-hand side. A save modal will appear, as seen below, where you can specify the filenames and privacy settings for your plot and data grid.

Save main

For more information on privacy settings and how sharing works, visit Chart Studio's sharing tutorial.