# Distribution Plots

The *Distribution Plots* object allows users to visualize categorical data variables using mainstream plots such as bar charts, pie charts, histograms, and polygons with an interactive interface and several configuration options. It is a useful object to visualize a general profile of your dataset.

In Astera, users can plot these graphs on data with up to half a million categories and display it easily with the drill-down feature.

In this document, we will learn how the *Distribution Plots* object can be used to plot and visualize your data.

### Bar Chart

A bar chart is a pictorial representation of grouped data in the form of rectangular bars. The height of the bars depends on the aggregates of numeric fields, grouped together by distinct categories of a categorical variable.

Users can construct a simple bar chart as well as a stacked bar. For the following example, you can download the sample data file from here (hyperlink).

#### Using Distribution Plots

1. To get a *Distribution Plots* object from the Toolbox, go to *Toolbox > Visualization > Distribution Plots* and drag-and-drop the plot object onto the dataflow designer.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FCpr7BLF4B1FZ9d0kX06p%2F1.png?alt=media\&token=6627094e-1976-48e3-9b32-b00abfc653cf)

2. Auto-map the source fields by dragging and dropping the root node of the source object onto the *Bar* (input) node of the *Distribution Plots* object.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fa47sX0LvnJHDpMDh6CWa%2Fimage-20210913132807341.png?alt=media\&token=a6282eae-b3e7-430a-bb79-19204a2cd2e4)

3. Right-click on the object’s header and select *Properties* from the context menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FEk9GuLeBjvqvemMbgkRr%2F2.png?alt=media\&token=f4b8bde9-afc7-4da5-8656-37fce55648a0)

A configuration window will open as shown below. This is the *Layout Builder*, where users have the option to change the name or *Data Type* of the fields, apply expressions, and provide a *Default Value* in case of null and empty records.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FQGXwOK6bNpEefmnYm2oY%2Fimage-20210913133019297.png?alt=media\&token=0f167c67-577d-43e4-a381-fa4484af2cb9)

Click *Next*. Here, users have the option to select *Plot Type* and define plot properties.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F3By0Ban9uUHhqOZoUQMF%2Fimage-20210913133324530.png?alt=media\&token=4d0a29cb-19bc-4698-b4bd-634f4e50c2a1)

4. *Plot Type* is set as *Bar* by default. The drop-down menu of this options contains several plot types.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fw7SZ87tIc6rFqCM0pIgF%2Fimage-20210913133911964.png?alt=media\&token=0978ba35-b0e7-46c9-8dde-bee1b51d3049)

5. Set *Aggregate by* to *Frequency*. The drop-down menu of this option contains 5 aggregate functions.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fp8Y8dqvYLAnXDmO26fTY%2Fimage-20210913134505005.png?alt=media\&token=fb8b2ec0-19ee-4d61-9367-64f5dcd3cceb)

6. In the *Plot Fields* group box, users can select a *Data Field* to apply the selected aggregate function. Only with *Frequency* aggregate type, the object automatically selects the first mapped field and disables the option, as shown below.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FYlcMbwnx80GEholO3WcV%2Fimage-20210913135413101.png?alt=media\&token=45dfbf8c-460b-48d7-b16d-7b491387759a)

There are additional plot display properties under the *Bar Properties* group box.

* *Horizontal Bars* – Changes the orientation of default vertical bars to horizontal bars.
* *Show Data Labels* – Displays data labels inside bars when the chart is rendered.

Check these options and click *Next*.

A *Labels* screen will appear. Here, users can fill in the labels for *Title*, *Subtitle*, *X-Axis*, and *Y-Axis*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FaHgCCdrDPEOtlq0f771s%2Fimage-20210913145149258.png?alt=media\&token=afe926ea-bec6-4ebe-9f85-e8d626df0404)

Click *Next*. An *Additional Options* screen will open, providing the following controls.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FI8AdFmf3ZgvjfYRV9smz%2Fimage-20210913145559161.png?alt=media\&token=3f071b71-4dde-4c10-a329-e26b806c123b)

**General Plot Options**

* *Scale Axis* – Scales the x-axis and y-axis as per the starting values of respective tables.
* *Inverted Graph* – Inverts the graph by displacing the axis.
* *Data is Sorted* – Sorts incoming data in case it’s unsorted.
* *Enable Data Zoom* – Provides controls to zoom on data points with respect to both axis

Save the plot with .html extension by selecting the *Save Plot* checkbox.

7. To visualize the plot, right-click on the *Distribution Plots* object’s header, and select *Visualize Data* from the context menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FZLwzKqjJdIc4nggHlmAv%2Fvisualization_data.png?alt=media\&token=aa0f2675-f0bd-4d78-9c4c-6498f9526727)

A *Visualization* window will open, displaying the bar chart. You can click on the bars and drill down to next level of categories.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FfZFLPkCgOOjHu7mijxsa%2F2021-09-13-15-46-34.gif?alt=media\&token=a7284de6-a2d4-4c35-88d5-ca0a36dc182e)

On the same data, users can also plot *Stacked Bar* available in *Plot Types* drop-down menu.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FRi6pzIu2nDlvygsbiwnv%2F2021-09-13-15-49-25.gif?alt=media\&token=ec70e305-ec2d-4873-a1ca-f7ec2541ff48)

### Pie Chart

A pie chart is a pictorial representation of grouped data in the form of sectors of a circle. The area of the sectors depends on the respective percentage proportion of categories in a data field.

Users can construct a simple pie chart, a doughnut chart, and a nested pie.

For the following example, you can download the sample data file from here (hyperlink). A simple pie chart is configured the same way as a bar chart. Therefore, in this example, we will create a nested pie that has different configuration settings.

#### Using Distribution Plots

1. Follow steps 1-3 of *Bar Chart* example.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FfeOqkxrX84jZM27CBSPe%2Fimage-20210913170005799.png?alt=media\&token=58a05cc3-360f-4e4c-b1bf-fbd8122dec8d)

2. Set *Plot Type* to *Nested Pie*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FwEBPio71UgnxiyO8XHZo%2Fimage-20210913162230795.png?alt=media\&token=72cdf385-6446-49a5-81ab-f2ec4b21725a)

3. In the *Plot Fields* group box, users can select an *Inner Field* and an *Outer Field* for respective inner and outer pies.

There are additional plot display properties under the *Pie Properties* group box.

* *Outer Chart Type* – Provides two outer chart display options.
  * *Doughnut*:

    ![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FMYxF88bBkFHvA4XWOz7T%2Fimage-20210913171452849.png?alt=media\&token=d58d8a21-608f-46df-8ca8-1a054d0614cf)

    ![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FL9IysFHznPT7MKoOsjeL%2F2021-09-13-18-34-57.gif?alt=media\&token=11461981-1f32-48e8-af7f-539a6b54b0d3)
  * *Nightingale:*

    ![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F6ZP8BGZxzEVwyRC4xa0i%2Fimage-20210913171526401.png?alt=media\&token=9dc4764b-1ce2-4725-b702-f1badf7f5924)

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FnRIvmFdNTdP7q1qCAfPy%2F2021-09-13-18-37-15.gif?alt=media\&token=538566f1-1eb9-4a17-a173-d94631cb1f50)

This concludes our discussion on using the *Distribution Plots* object in Astera.
