4

I am looking for a simple way to create a worldmap in python. For example, let's take the following country data:

world_data = {
  'af': 141,
  'bd': 5,
  'by': 2,
  'cn': 10,
  'gm': 90,
  'in': 43,
  'ir': 314}

Is there any simple way to create a worldmap with customized coloring and color threshold for this data?

At the moment I am using pygal (see below). Unfortunately, I did not find any way for pygal to print a color legend or define thresholds for the coloring.

worldmap_chart = pygal.Worldmap()
worldmap_chart.add('data', world_data)
worldmap_chart 

Any help is appreciated

Andy
  • 9,483
  • 12
  • 38
  • 39

1 Answers1

1

You can utilize any Python data visualization library including :

Here's a list of some overviews of tools :

The one I prefer is a combination of Python and D3.js which is a Javascript visualization library. Here's an example using a map :

http://adilmoujahid.com/posts/2015/01/interactive-data-visualization-d3-dc-python-mongodb/

bigreddot
  • 33,642
  • 5
  • 69
  • 122
Meghdeep Ray
  • 5,262
  • 4
  • 34
  • 58
  • Thanks, those libraries look great. But I am looking for a simple solution. At best only requiring a few code lines. Athough it would be nice no iteractivity is required either. – Andy May 26 '15 at 07:40
  • As far as I'm aware you'll have to use a library, I don't know of a way with only a few lines but I'm sure if you look into any one of those (I'd recommend bokeh) I'm sure it won't take more than say 10 lines. – Meghdeep Ray May 27 '15 at 05:07