Creating Plot Visualization using Python in Power BI

You are currently viewing Creating Plot Visualization using Python in Power BI

People with an IT background attending the Power BI Online training find it easier to use Python in Power BI then DAX. However, people with business background attending Power BI online training find DAX easier. Power BI’s developers ensure that Power is useful for people with all technical and non-technical backgrounds. An example of such instance is the creation of visuals using interface of Power BI and programming language of Python. Python’s Matplotlib is a powerful visualization library to support data visualization. Matplotlib was essentially developed to make visualization easier for MATLAB users.

 

This blog assumes that the reader is familiar with the basic python syntax and has python installed on his local machine. However, if you’re new to this language. Here’s a list of blogs to get started:

In this blog post, a step by step guide on downloading, installing and integrating python with Microsoft Power BI is presented.

This blog discusses the importing and manipulating in Python scripts in Power BI..

Box plot is one of the most recommended visuals for exploratory data analysis. It is also known as box and wisker plot and displays the data distribution using the data quartiles. Box plot can be created in Power BI using some python libraries such as Matplotlib and Pyplot. This blog posts presents a step-by-step guide to creating a box plot in Power BI desktop using python.

Creating Plot Visualization

This visualization plot draws lines in the plotting area. We will be using the powerful Matplotlib library. The picture below shows the use of  plot() visualization. If you use a single list then matplotlip will assume the sequence as y values and will generates x values for it. The x values start from 0.

To get started:

1. Open the Python script editor.

2. Type the code as shown below.

Power BI Online Training in Adelaide - Creating Python based visuals

The above Python script generates the following plot.

Power BI Online Training in Perth - Creating Python based visuals

Now we will be customizing our Visual.

3. To give more clarity to our visual, we will be adding labels to our chart. For the definition of labels, type the below code.

Power BI Online Training in Brisbane - Creating Python based visuals

The code snippet above adds labels to the axis of the plot. It will generate  the following output.

Power BI Online Training in Melbourne - Creating Python based visuals

You can also customize the chart title using the ‘Title’ property in the format area.

4. To go to Format Area click on the following icon.

Power BI Online Training in Sydney - Creating Python based visuals

The following tab will appear.

5. Then click on Title.

Power BI Online Training - Configuring Python based Visuals

You can write your title in the ‘Title text’ field. You can also change the following properties.

  • Font color
  • Background color
  • Text size
  • Text font
  • Text alignment

Below is an example of a customized chart title.

Power BI Online Training - Python based visualization

Conclusion:

Plots drawn in Power BI using python’s Matplotlib are similar to the ones drawn in any other python environment. These plots are also essentially different from the contemporary visualization visuals supported in Power BI. The type of plots that can be drawn in Power BI using python are highly dependent on the power of Python’s visualization library. In this blog post, a step by step guide on creating plots using Python’s Matplotlib is presented.

 

More Checkouts for Power BI Training in Australia.

Power BI Basic training course across Australia.

Power BI Advanced training course across Australia.

Power BI DAX training course across Australia.

Power BI Corporate training across Australia.

 

 

Leave a Reply