To do this, we used a googleviz geochart of the United States and ploted the cities based on their rank.
Geo <- gvisGeoChart(bcities, locationvar="City",colorvar="Rank", options=list(region="US", height=350, displayMode="markers", colorAxis="{values:[1, 17, 34, 50], colors:[\'red', \'pink\', \'orange',\'green']}") )
Geo
## <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
## "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
## <html xmlns="http://www.w3.org/1999/xhtml">
## <head>
## <title>GeoChartID1ae01153150</title>
## <meta http-equiv="content-type" content="text/html;charset=utf-8" />
## <style type="text/css">
## body {
## color: #444444;
## font-family: Arial,Helvetica,sans-serif;
## font-size: 75%;
## }
## a {
## color: #4D87C7;
## text-decoration: none;
## }
## </style>
## </head>
## <body>
## <!-- GeoChart generated in R 3.4.1 by googleVis 0.6.2 package -->
## <!-- Tue Oct 31 14:02:42 2017 -->
##
##
## <!-- jsHeader -->
## <script type="text/javascript">
##
## // jsData
## function gvisDataGeoChartID1ae01153150 () {
## var data = new google.visualization.DataTable();
## var datajson =
## [
## [
## "Los Angeles",
## 50
## ],
## [
## "Anchorage",
## 49
## ],
## [
## "Omaha",
## 48
## ],
## [
## "St. Louis",
## 47
## ],
## [
## "Cleveland",
## 46
## ],
## [
## "Chesapeake",
## 45
## ],
## [
## "Phoenix",
## 44
## ],
## [
## "Scottsdale",
## 43
## ],
## [
## "Reno",
## 42
## ],
## [
## "Dallas ",
## 41
## ],
## [
## "Virginia Beach",
## 40
## ],
## [
## "Charlotte",
## 39
## ],
## [
## "Tulsa",
## 38
## ],
## [
## "Indianapolis",
## 37
## ],
## [
## "Colorado Springs",
## 36
## ],
## [
## "Tampa ",
## 35
## ],
## [
## "Lincoln",
## 35
## ],
## [
## "San Jose",
## 33
## ],
## [
## "Rochester",
## 32
## ],
## [
## "Oakland",
## 31
## ],
## [
## "San Antonio",
## 30
## ],
## [
## "Baltimore",
## 29
## ],
## [
## "Chicago",
## 28
## ],
## [
## "Arlington",
## 27
## ],
## [
## "Milwaukee",
## 26
## ],
## [
## "Lexington",
## 25
## ],
## [
## "Philadelphia",
## 24
## ],
## [
## "Oklahoma City",
## 23
## ],
## [
## "Houston",
## 22
## ],
## [
## "Cincinatti",
## 21
## ],
## [
## "Columbus ",
## 20
## ],
## [
## "Honolulu",
## 19
## ],
## [
## "Raleigh",
## 18
## ],
## [
## "Madison",
## 17
## ],
## [
## "Atlanta",
## 16
## ],
## [
## "Kansas City",
## 15
## ],
## [
## "New Orleans",
## 14
## ],
## [
## "Nashvile",
## 13
## ],
## [
## "Minneapolis",
## 12
## ],
## [
## "Pittsburgh",
## 11
## ],
## [
## "St. Paul",
## 10
## ],
## [
## "San Diego ",
## 9
## ],
## [
## "Austin",
## 8
## ],
## [
## "New York",
## 7
## ],
## [
## "Denver",
## 6
## ],
## [
## "Portland",
## 5
## ],
## [
## "Boston",
## 4
## ],
## [
## "Washington",
## 3
## ],
## [
## "Seattle",
## 2
## ],
## [
## "San Francisco",
## 1
## ]
## ];
## data.addColumn('string','City');
## data.addColumn('number','Rank');
## data.addRows(datajson);
## return(data);
## }
##
## // jsDrawChart
## function drawChartGeoChartID1ae01153150() {
## var data = gvisDataGeoChartID1ae01153150();
## var options = {};
## options["width"] = 556;
## options["height"] = 350;
## options["region"] = "US";
## options["displayMode"] = "markers";
## options["colorAxis"] = {values:[1, 17, 34, 50], colors:['red', 'pink', 'orange','green']};
##
##
## var chart = new google.visualization.GeoChart(
## document.getElementById('GeoChartID1ae01153150')
## );
## chart.draw(data,options);
##
##
## }
##
##
## // jsDisplayChart
## (function() {
## var pkgs = window.__gvisPackages = window.__gvisPackages || [];
## var callbacks = window.__gvisCallbacks = window.__gvisCallbacks || [];
## var chartid = "geochart";
##
## // Manually see if chartid is in pkgs (not all browsers support Array.indexOf)
## var i, newPackage = true;
## for (i = 0; newPackage && i < pkgs.length; i++) {
## if (pkgs[i] === chartid)
## newPackage = false;
## }
## if (newPackage)
## pkgs.push(chartid);
##
## // Add the drawChart function to the global list of callbacks
## callbacks.push(drawChartGeoChartID1ae01153150);
## })();
## function displayChartGeoChartID1ae01153150() {
## var pkgs = window.__gvisPackages = window.__gvisPackages || [];
## var callbacks = window.__gvisCallbacks = window.__gvisCallbacks || [];
## window.clearTimeout(window.__gvisLoad);
## // The timeout is set to 100 because otherwise the container div we are
## // targeting might not be part of the document yet
## window.__gvisLoad = setTimeout(function() {
## var pkgCount = pkgs.length;
## google.load("visualization", "1", { packages:pkgs, callback: function() {
## if (pkgCount != pkgs.length) {
## // Race condition where another setTimeout call snuck in after us; if
## // that call added a package, we must not shift its callback
## return;
## }
## while (callbacks.length > 0)
## callbacks.shift()();
## } });
## }, 100);
## }
##
## // jsFooter
## </script>
##
## <!-- jsChart -->
## <script type="text/javascript" src="https://www.google.com/jsapi?callback=displayChartGeoChartID1ae01153150"></script>
##
## <!-- divChart -->
##
## <div id="GeoChartID1ae01153150"
## style="width: 556; height: 350;">
## </div>
## <div><span>Data: bcities • Chart ID: <a href="Chart_GeoChartID1ae01153150.html">GeoChartID1ae01153150</a> • <a href="https://github.com/mages/googleVis">googleVis-0.6.2</a></span><br />
## <!-- htmlFooter -->
## <span>
## R version 3.4.1 (2017-06-30)
## • <a href="https://developers.google.com/terms/">Google Terms of Use</a> • <a href="https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart">Documentation and Data Policy</a>
## </span></div>
## </body>
## </html>