Interactive Charts using R and Power BI: Create Custom Visual Part 3

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Col

In the last two posts (Part 1 and 2), I have explained the main process of creating the R custom Visual Packages in Power BI. there are some parts that still need improvement which I will do in next posts. In this post, I am going to show different R charts that can be used in power BI and when we should used them for what type of data, these are Facet jitter chart, Pie chart, Polar Scatter Chart, Multiple Box Plot, and Column Width Chart. I follow the same process I did in Post 1 and Post 2. I just change the R scripts  and will explain how to use these graphs

1-Jitter Chart

This chart has been used to show all data points. Also, it shows three variables in at the same time: two numeric variable for x and y axis and one factor variable with different colours. In the below picture you will see that I created a custom visual that shows the speed of the car in the city in x axis, the car’s speed in high way in Y axis and the number of cylinders as factor variable in chart legend.

Jitter

 

also there is a possibility to show 4 or 5 variable at the same time. One for x axis, y axis, the colour shade that should be factor, two factor variable for Facet and different tiles. in the below GIF you see that I show the speed of car in city and highway in x and y axises, also I put the year in to z variable. Moreover, for different tiles I need two variables one for year and another factor variable for Fl of cars. this custom visual get constant 5 variables as x,y,z,w, and v. I have a post on this chart before see http://radacad.com/have-more-charts-by-writing-r-codes-inside-power-bi-part-2

 

Facet

The code for generating the chart has been shown below

 

2-Pie Chart

Pie chart able to shows the composition of data. In the below example, I have shown how to show the composition of the car’s speed in highway as a continues variable with grouping them based on FL of the car. this chart shows the labels inside the pie chart (in power bi it shows outside)

 

pie

The code for generating the chart has been shown below

 

3-Polar Scatter Chart

this chart has been used to show two numeric variable, which one of the should have wider range for instance from 0 to 365 or 177 to -177 also another variable should be a limited range for instance from 0 to 10 or from 0 to 1. we need another factor variable to show the colour. in the below gif, you will see we have a variable that range from 0 to 1 and the other one from 0 to 270. also we have a factor variable that shows the lines in graph in different colours.

 

Polar

The code for generating the chart has been shown below

 

4-Box Plot

It always important to have a holistic perspective regarding the minimum, maximum, middle, outliers of our data in one picture.
One of the chart that helps us to have a perspective regard these values in “Box Plot” in R. I have already a post on this concepts and how to have it see :

http://radacad.com/visualizing-numeric-variables-in-power-bi-boxplots-part-1

 

here I have shown how to make them more interactive via Plotly , having more plots in one chart regarding a factor variable.

box

 

The code for generating the chart has been shown below

5- Column Width Chart

for comparison purpose most of the charts can be available in Power BI Visualization, just two of them are not :Variable Width Column Chart and table with table embedded chart (I will show it next post hopefully)  . This chart help us to do compare two variable in a bar chart. we have height and width of the bar chart. in normal bar chart the bar width are same size the process of creating this chart has been explained in post : http://radacad.com/variable-width-column-chart-writing-r-codes-inside-power-bi-part-4

Here am going to create a custom visual to show how to have them. the dataset that I have has information about the car speed in city and highway plus the number of cylinder and their type of drive (four wheel drive, rear drive or front drive).

to do that first in power BI I create two separate dataset that has been group by :1- number of cylinder and 2- type of drive.

Col

 

 

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail
rssyoutuberssyoutube
Leila Etaati
Dr. Leila Etaati is Principal Data Scientist, BI Consultant, and Speaker. She has over 10 years’ experience working with databases and software systems. She was involved in many large-scale projects for big sized companies. Leila has PhD of Information System department, University of Auckland, MS and BS in computer science. Leila is Microsoft Data Platform MVP.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">