Show Sidebar Hide Sidebar

Line or Scatter Graphs in Plotly 2.0

Create a graph with multiple traces.

Step 1

Try an Example

If you want to make a graph with multiple traces and need a little help, this tutorial is for you!

After selecting 'Line Plot' under 'Chart Type', you can check out an example before adding your own data. Clicking the 'try an example' button will show what a sample chart looks like after adding data and playing with the style. You'll also see what values and style attributes were selected for this specific plot, as well as the end result.

Example Scatter

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

Open data

Step 2

Add Your Data to Plotly

Head to Plotly’s new online workspace 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. Plotly accepts .xls, .xlsx, or .csv files. For more information on how to enter your data, see this tutorial.

Import data main

Step 3

Create a Chart

After adding your own data, go to GRAPH on the left-hand side, then 'Create'. Choose 'Line Plot' under 'Chart type'.

Choose chart main

Click on GRAPH on the left-hand side to add your values to your graph. After selecting ‘Line Plot', you should then fill out the x and y dropdowns to create the plot.

Adding x and y axis

This will create a raw line graph as seen below.

Raw chart

For charts that have many values such as this one, we need to add more data to the plot. We do this by clicking on the '+Trace' button at the top right-hand side of that pane.

Trace open

You can add as many traces as you need, until your plot is complete! For this particular graph, we want to compare two different toothpastes for the prevention of caries development. Each toothpaste has a mean decayed, missing, and filled surfaces (DMFS) index, and a standard deviation DMFS index. We'll need four traces, and this is what the plot looks like after we've finished tracing.

Finished traces

To mix it up a bit, we'll have the mean DMFS as a line graph, and the standard deviation DMFS as a scatter plot. We do this by going to the same panel with the x and y values, hit the 'Collapse All' button on the right-hand side of that panel, then open the trace we want to work on. In this case, it's the standard deviation value for toothpaste A and B. Click on 'Chart Type' and select 'Scatter Plot'.

Finished plot

Step 4

Style a Chart

We're almost done! Now it's time to choose the color, text position or typeface. Click on STYLE on the left-hand side to play around with the style of your plot.

To change the color of the lines and points, click on ‘Traces’ under the same STYLE tab, and choose the color you want. Note that certain colors and typeface are only available with a PRO subscription. Click here to upgrade!

Colour main

We've made the values of Toothpaste A gray, and the values of the Toothpaste B turquoise. We've also added a very thin line through each scatter plot.

Colour and line

To add a title to your graph, you can type it directly on the title by double-clicking it.

Type directly title

The same can be done for the axis labels and legend. We've added a break in the legend labels using HTML syntax so that they appear in two separate lines. To learn more about HTML and how to add tags and codes to your text, visit this page!

Type directly axis

Another option is to visit the 'Layout' section under STYLE, click on 'Text' and enter your title in the box, as shown below.

Type in layout panel

Step 5

Save and Share

Your plot is now done! Click SAVE on the left-hand side.

Save main

Give your file a name, then select your PLOT and DATA as 'Public' or 'Private'. For more information on how sharing works, including the difference between private, public and secret sharing, visit this page.

Save pop-up

Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to our Premium or Enterprise plans.