Deepnote
IntegrationsPricing
Join usDocs

Getting started

Deepnote documentation

Features

Chart blocks

Environment

Chart blocks

No-code charts for fast exploratory analysis

Chart blocks allow you to create charts from Pandas DataFrames without using code. They are perfect for fast exploratory analysis, or for those who are not familiar with how to make charts using Python code.

To get started, you can watch our quick demo on chart block configuration.

For practical examples of how to use charts for exploratory analysis, check out this notebook.

Adding a chart

You can add a chart block to your notebook by clicking on the Visualize button in the upper right corner of a Dataframe output table.
Alternatively, you can also add a chart block by pressing the add block (+) button in between blocks and selecting the Chart option from the menu.
Screenshot 2022-11-08 at 9.23.06 (1).png

Setting up the data

To start, you need to select a DataFrame to visualize in the upper left corner. Once you picked your dataset, you can configure your chart with the options under the Data tab.

At Type, you can choose from four different ‘marks’ for your chart (bar, line, area and point charts). These types define the basic geometrical representation of your data. They act as starting points from which you can build the most common exploratory chart types. For instance, from a bar chart, you can create histograms, stacked bar charts, grouped bar charts and even heatmaps by using the various settings.

At the X and Y axis, you can select the specific columns you wish to visualize from your dataset.

Aggregation

Once you added a column to an axis, you can see the applied aggregation displayed next to the column name. You can click on this button to change the aggregation function for the given column.
Screenshot 2022-11-08 at 10.16.00.png

On bar, line and area charts, SUM() aggregation is applied automatically when you select a quantitative column.

Binning

Binning is a special type of transformation which you can apply from the same menu as aggregations. This is particularly useful for creating histograms for quantitative columns.
Screenshot 2022-11-08 at 10.28.47.png

You can override the default bin size by typing a value in the text box.

Data types

The selected columns on the charts are automatically assigned one of three data types: categorical, quantitative and time. You can see the current data type indicated as an icon on left side of the column name.

In certain cases, you may want to change the inferred data type. For instance, datetime variables may not be identified as such when you read data from a CSV file. You can change the data type easily by clicking on the icon.

Sorting

When you add a dimension (categorical or time) column to an axis, a sorting button (AZ) will be displayed next to it. You can click on it to access various sorting options.
Screenshot 2022-11-08 at 10.36.01.png

Ascending and descending will sort the categories in alphabetical order. Ascending and descending by [column] will sort the categories according to the values of your applied quantitative column.

Group by

You can break down your chart along a secondary grouping dimension by selecting a categorical column at the Color selector. On bar charts, this will create a side-by-side (grouped) bar chart with the secondary grouping shown as different coloured bars.
Screenshot 2022-11-10 at 16.55.43.png
You can change the layout of the secondary grouping at the Stacking options.
Screenshot 2022-11-10 at 16.56.25 (1).png

Stacked creates a stacked bar chart. Stacked %-normalized will create a stacked bar chart with the values normalized to a percentage scale.

Other visual encodings

Screenshot 2022-11-08 at 11.08.00.png

Besides group by, the Color selector can also be used to apply a color scale to your chart based on the values in a quantitative column. You can pick a different color scale by using the color picker.

Size provides an alternative option for visual encoding by mapping the values in a quantitative column to:

  • width of bars (bar chart)
  • width of lines (line chart)
  • size of points (point chart)
You can use Size in combination with color scale encoding to build more complex visualisations.
Screenshot 2022-11-08 at 11.24.22.png

Multiple layers

In certain cases, you may wish to visualize multiple quantitive columns (e.g a secondary axis) from your dataset within a single chart. You can do that by adding multiple layers to you chart.

You can either duplicate an existing layer or create a new one from scratch.

Each new layer has their independent configuration options (Data and Format). For instance, you can change the chart type on the second layer to line chart and thus create a bar+line combo chart.

You can create a color legend for multi-layered charts by selecting Measure Name at Color. This option will automatically display the name of the selected quantitative column in the legend and will assign a unique color to it. You can also customize the name of the legend item by typing in the text field at the Measure Name option.

Secondary measures

The quickest way for displaying multiple quantitive columns is to use the add secondary measure (+) button displayed next to your quantitative column. Click on it, pick your secondary measure and we will create a new chart layer with all settings pre-configured for you, including the legends
If your secondary measure happens to be on a different scale, you can also switch to dual axis mode under the Display tab. This will visualise the two measure axes independently.
Untitled (2).png

Formatting of axes

You can access various formatting options for the given chart layer by clicking on the Format tab. The settings listed here are based on the selected columns (X and Y axis) on the Data tab.
Screenshot 2022-11-08 at 12.44.01.png

You can modify the axis titles with a custom label or optionally hide them. For quantitative axes, you can also choose a different scale (e.g. logarithmic) and apply a custom range to the visualized values.

Display settings

Click on the Display tab to adjust general settings applied to the whole chart canvas.
Screenshot 2022-11-08 at 12.47.51.png

You can add a custom title to the chart. You can select the placement of the chart legend or hide it optionally. You can also turn off the tooltips (displayed when you hover over a data point) and the grid lines.

Customize charts with code

If you need more flexibility to customize your charts, you can duplicate your chart block into code by selecting the option in the block actions menu.

This adds a new Python code block to your notebook, containing the configuration of your chart in the Vega-lite specification format. Vega-lite is very powerful and fairly easy to learn so it’s a great option if you need to create a finely customized or super advanced visualisation.

In this example below, we are changing from a bar chart to a classic heatmap view by changing the mark type to rectangle ('rect').

Resizing charts

Once you’ve finalized your chart, you can collapse the configuration sidebar to make the chart fill out the whole block. If you wish to present charts on larger displays, you can switch to full-width mode for your notebook. You can also vertically resize the chart by dragging the resize handle at the bottom of the chart canvas.

Limitations

Chart blocks can display a maximum of 10 thousand rows of data. If you plot datasets larger than this, only the first 10k rows will be visualized. You can aggregate or filter the data prior to visualization to get under this limit.

Deepnote
Product
© 2022 Deepnote. All rights reserved.