Creating a Joint Plot in Power BI using python

You are currently viewing Creating a Joint Plot in Power BI using python

Joint plot draws attention of many attendees of our Power BI training in Australia because this plot helps the users to detect the relationship between different variables using python inside the Power BI desktop. Python’s integration in Power BI desktop has opened a new door to newer visualization techniques. In this blog post, a step-by-step guide to creating a joint plot in Power BI using python has been presented. Before we get started, lets understand the basic concepts first.

What is a Joint Plot?

A joint consists of three subplots where:

  • one plot displays a bivariate graph which shows how the dependent variable(Y) varies with the independent variable(X).
  • The second plot is placed horizontally at the top of the bivariate graph, and it shows the distribution of the independent variable(X).
  • The third plot is placed on the right margin of the bivariate graph with the orientation set to vertical and it shows the distribution of the dependent variable(Y).

Python libraries used in this blog:

In this blog post, Python’s two visualization libraries Matplotlib and Seaborn have been used. Matplotlib derives its name from MATLAB and was initially developed to provide MATLAB-like interface to the users.  Matplotlib is mainly used to produce 2D graphs and 3D graphs with the help of toolkit. Seaborn on the other hand is the go-to library for exploratory data analysis. Seaborn has a dataset-oriented API with a capacity to examine the relationship between the variables. It adds to the capacities of Matplotlib for generating multi-structure graphs, formatting and styling of graphs and supporting built in themes.

Data set used in this blog:

For this blog you need to download IRIS dataset which is publicly available. You can download the dataset from https://gist.github.com/netj/8836201.

Helpful blogs for beginners:

Opening the Script Editor

In order to create visuals, follow the below mentioned steps:

  1. Select Visualization Tab under the Visualizations Pane.
Creating A Joint Plot In Power BI Using Python in Power BI Training in Sydney

2. Click on Python Visual. The following window will appear.

Creating A Joint Plot In Power BI Using Python in Power BI Training in Melbourne

3. Click on Enable to enable Python Scripts. The following window will appear.

Creating A Joint Plot In Power BI Using Python in Power BI Training in Brisbane

Python script editor automatically creates the dataset using the library Pandas. It creates the data frame with required column fields.

4. Now to start scripting, drag and drop fields into the Visualizations pane. Or you may also check the checkboxes for adding them into the script editor.

Create a Joint Plot

A joint plot is an upgraded form of scatter plot. It is used to observe the correlation between two variables. To create a joint plot, we will write the following code.

1. Open the Python Script Editor

2. Enter the code as shown in the screen shot below.

Creating A Joint Plot In Power BI Using Python in Power BI Training in Perth

3. The following plot will be generated.

Creating A Joint Plot In Power BI Using Python in Power BI Training in Adelaide

Conclusion:

Python’s Matplotlib and Seaborn are used to develop multi-structure graphs such as a joint plot. A joint plot is used to visualize the relationship between different variables. It finds the correlation between two variables and displays it in a format that looks like an upgraded version of the scatter plot. In this blog post, a step-by-step guide on creating a joint plot using python in Power BI has been presented.

Learning Power BI from Scratch? Get a complete, in-depth introduction to Microsoft Power BI tool by attending our Power BI Basic Training Course.

More Checkouts for Power BI Training in Australia

Power BI Training in Sydney

Power BI Training in Melbourne

Power BI Training in Brisbane

 

Leave a Reply