Designing R chart in #Powerbi just got a lot easier for a R novice

I have for a long time had the wish to use the power of R to create some fancy visuals in PowerBI, but I simply haven’t had the time to read the manual 🙂

Then today I saw a retweet about how to make ggplot2 easily –


And thought that might be able to help me get started – AND IT SURE DID

The tools are still under development so expect a few bumps

First – RStudio

You need to install RStudio on your computer to support the Addin. So if you haven’t done so already – go to https://www.rstudio.com/

To install the addin you can follow the instructions on the github site for the addin – https://github.com/dreamRs/esquisse

Simply insert this in code window and run it

 Designing R chart in #Powerbi just got a lot easier for a R novice

R-Studio will then install the addin and all its help files etc.

Now we can run the addin by running this line

esquisse::esquisser()

and the design window will pop-up

 Designing R chart in #Powerbi just got a lot easier for a R novice

But the magic happens when we do it from PowerBI Desktop

So I created a small data model based on AdventureWorksDW2014 database – for the ResellerSales

 Designing R chart in #Powerbi just got a lot easier for a R novice

And I plot all the resellers by Sales_Amount and Sales_Profit and use the business type as the legend.

Then I insert the same fields in an R visual

 Designing R chart in #Powerbi just got a lot easier for a R novice

And in order for the R- Visual to show a chart we have to open the R-Script Editor at the bottom of the screen

 Designing R chart in #Powerbi just got a lot easier for a R novice

And now I have to paste or type my R-script code here ….. and this is typically where I previously started to search on google for what I needed to do.

I would quickly find the library ggplot2 was needed to create a scatterplot but then I needed to find out a lot about formatting and legends and axis etc. and normally I would give up within a few hours perhaps

 Designing R chart in #Powerbi just got a lot easier for a R novice

The addin to the rescue

It is actually possible to activate the AddIn from the R Script editor 😀

 Designing R chart in #Powerbi just got a lot easier for a R novice

If we add this line to the editor – and click RUN – magic will happen

esquisse::esquisser()

It loads the designer in the browser !!!

 Designing R chart in #Powerbi just got a lot easier for a R novice

Our dataset is automatically available in dialog for choosing the dataset

 Designing R chart in #Powerbi just got a lot easier for a R novice

635 records and 4 fields !!!

Choosing the dataset will give us a validation of the fields (OBS -Don’t use spaces in the fields you add !!)

 Designing R chart in #Powerbi just got a lot easier for a R novice

We can now drag the fields to the different areas of axis, color and size and start to format the chart further

 Designing R chart in #Powerbi just got a lot easier for a R novice

It will automatically switch between different types of visualizations depending on what you choose – and you can via the menus at the bottom do a lot of formatting and when you are done – you can open the Export & code windows and copy the code to the clipboard.

 Designing R chart in #Powerbi just got a lot easier for a R novice

Then close the window and switch back to Power BI Desktop and paste in the code

 Designing R chart in #Powerbi just got a lot easier for a R novice

Remember comment out the line esquisse::esquisser() by adding a # in front

Click on the Run Script and minimize the R Script editor and the R chart is now in your desktop – awesome!!!

 Designing R chart in #Powerbi just got a lot easier for a R novice

The chart types supported in ggplot2 are these

 Designing R chart in #Powerbi just got a lot easier for a R novice

And designing and using them just got a lot easier.

So I recommend that you follow and support them on github and help them fix bugs by reporting any issues.

Power ON!

Let’s block ads! (Why?)

Erik Svensen – Blog about Power BI, Power Apps, Power Query