I've been trying to create a world map using pygal for python. I'm using python 3.9 and pycharms on a mac. I've tried using the code in the link below. Here's part of the code that I copied and tried to execute. When I run it, no errors occur but no file is rendered. The "maps" in "pygal.maps.world.World()" is highlighted and says "Cannot find reference maps in init.py".
worldmap_chart = pygal.maps.world.World()
worldmap_chart.title = 'Minimum deaths by capital punishement (source: Amnesty International)'
worldmap_chart.add('In 2012', {
'af': 14,
'bd': 1,
'by': 3,
'cn': 1000,
'gm': 9,
'in': 1,
'ir': 314,
'iq': 129,
'jp': 7,
'kp': 6,
'pk': 1,
'ps': 6,
'sa': 79,
'so': 6,
'sd': 5,
'tw': 6,
'ae': 1,
'us': 43,
'ye': 28
})
worldmap_chart.render()
link: http://www.pygal.org/en/stable/documentation/types/maps/pygal_maps_world.html
Where do you want to show the map?
You could use
render_in_browserif you havelxmlinstalled.To do that, replace the last line of your code with this.
Here's a list of the other output options http://www.pygal.org/en/stable/documentation/output.html.
This is how the map generated by the posted code appears in my browser (Chrome).