Drawing a background map is the first step of any geospatial analysis. Once this background is available, you can color each region to get a choropleth map, add points or bubble to get a bubble map, reshape the region to get a cartogram, or show connection with a connection map.
<!-- Include the CanvasXpress library in your HTML file --> <link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/> <script src="https://www.canvasxpress.org/canvasXpress.min.js"></script> <!-- Create a canvas element for the chart with the desired dimensions --> <div> <canvas id="canvasId" width="600" height="600"</canvas> </div> <!-- Create a script to initialize the chart --> <script> <!-- Create the data for the graph --> var data = false <-- Create the configuration for the graph --> var config = { "colorBy":"Order", "graphType":"Map", "mapConfig":{ "zoom":3.2 }, "mapConfigFeatures":{ "1":{ "scale":[ 0.5, 0.8 ], "translate":[ "-100", "-30" ] }, "11":{ "scale":[ 1.5, 1.5 ], "translate":[ "85", "-5" ] } }, "mapId":"customUSA", "topoJSON":"https://www.canvasxpress.org/data/maps/USA.json" } <!-- Call the CanvasXpress function to create the graph --> var cX = new CanvasXpress("canvasId", data, config); </script>
library(canvasXpress) canvasXpress( data=FALSE, colorBy="Order", graphType="Map", mapConfig=list(zoom=3.2), mapConfigFeatures=list("1"=list(scale=list(0.5, 0.8), translate=list(-100, -30)), "11"=list(scale=list(1.5, 1.5), translate=list(85, -5))), mapId="customUSA", topoJSON="https://www.canvasxpress.org/data/maps/USA.json" )