Show Sidebar Hide Sidebar

Color Points of a Scatter Plot by a Third Column

A Step by Step Guide to Color Points of a Scatter Plot by a Third Column

How to Color Points of a Scatter Plot by a Third Column

Iris Plant Traits, by Type

Step 1 : Set up the grid

R, a free programming environment for statistical computing and graphics, comes with several sample data sets to give you some data to work with right away. We’ve entered part of the sepal and petal data into a Plotly grid. Our data includes measurements on sepal length and sepal width of 150 different irises, catagorized into three different species.

Once you’ve loaded the data, click Fork and edit to move the data into your Plotly workspace.
Load iris data into your Plotly workspace.

Step 2: Graph the data

Select Scatter Plots from the MAKE A PLOT menu. Click choose as x and choose as y to specify the columns of $x$ and $y$ data. To color the data points by species, select Group By in the sidebar. Now you can select choose as G above the column of text, where the species information is contained. Click the blue Scatter plot button in the sidebar to create your graph. Partitioning data points for a scatter plot

Step 3: Editing Your Graph

Your graph should look something like this: Default three trace scatter plot
You can add or modify axis labels and the plot title by clicking and typing. Notice how the legend specifies the species of iris and each species has a different color on the plot. Axis titles and trace legends.
Plotly graphs are interactive! You can hover over the scatter points for more information. Styling options are contained in the TRACES popover. Learn more about our interactive features in three short videos. The final graph is interactive.
Still need help?
Contact Us

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