Map with connecting lines

Super User
Super User
Posts: 1,662
Registered: ‎12-15-2015

Map with connecting lines


This visual uses Maps package and Geosphere package to draw a map of Australia and dots on that map finally connecting them with lines. Using sample migration statistics data from different cities within Australia to the city of Melbourne, R visual shows the trend of migration by color coding the lines and shading higher count cities on top of the lower ones.


Prerequisites (The sample .pbix files won't work without installing the following)

1. Install R Engine

Power BI does not include the R engine.  Therefore, a seperate installation is required to install R on your local computer.  


Required R Packages




Tested on

MRO 3.3.1, CRAN 3.3.1

Posts: 17
Registered: ‎09-29-2015

Re: Map with connecting lines

this is so cool Ankit!

Posts: 86
Registered: ‎08-10-2016

Re: Map with connecting lines

Hi Ankit,


This visual is very impressive. If you consider to convert this or some of your other R-visuals to R-powered-custom visuals, out team will be happy to assist you. 


The visibility of R-powered custom visuals is greater and it is not limited for R-users. 

Frequent Visitor
Posts: 10
Registered: ‎07-02-2015

Re: Map with connecting lines

To get this R visual script to work, users will need to add the following commands before the two libray function calls:


Posts: 1
Registered: ‎05-15-2017

Re: Map with connecting lines

Hi Ankitpatira,


thanks for the visual. Really great one.



Hi Paul,

Can we install these packages before even having R installed? and sorry for the question but... how do we install packages?



thanks for your help

/Jose Miguel

Posts: 86
Registered: ‎08-10-2016

Re: Map with connecting lines

Hi @JoseMiguelPR

You need R engine installed to run R in Power BI. You can use any R IDE (like RStudio) to install packages 

See more here: