2D Histogram

A type of plot that visualizes a bivariate distribution.

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 Plotly 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.

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 Chart Studio.

Step 2

Add Your Data to Plotly

Head to Plotly’s 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. Plotly 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 '2D Histogram' under 'Distributions' chart type.

Next, select the 'X', 'Y' and 'Z' values from the dropdown menus. This will create a 2D histogram as seen below. Note that specifying 'Z' is optional. If specified, the histogram function can be configured based on 'Z' values. If omitted, the histogram function defaults to 'Count'.

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.

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.

To change the properties of the histogram such as the histogram function and normalization, binning and other trace properties, go to the 'Traces' section under the 'Style' menu.

Use the attibute 'Colorscale' to define the colorscale range for the 2D histogram. Additionally, to hide/show the colorbar, click the desired option next to the attribute 'Color Bar' under the same panel.

To set the size and positioning of the color bar, navigate to the 'Color Bars' section under the 'Style' menu. Then define the values for the corresponding attributes under the 'Size abd Positioning' property, as seen below.

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.

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