Could you please help me with this code:
import pygal
from pygal.maps.world import World
worldmap_chart = pygal.maps.world.World()
worldmap_chart.title = 'Some countries'
worldmap_chart.render()
I use Spyder. Python 3.6 .The problem is that the map does not show up on the IPython console, and also on the second line of the code, I get yellow triangle/note that says:
'pygal.maps.world.World' imported but unused.
Maybe this is the reason why the map does not show up.
Otherwise, if it helps, in the IPython console I get only this:
runfile('C:/Users/Nikki/.spyder-py3/untitled0.py', wdir='C:/Users/Nikki/.spyder-py3')
Could you please help me to fix this?
I do not personnaly use Spyder, but the third line of your code seems to be wrong, you should try this :
import pygal
from pygal.maps.world import World
worldmap_chart = World()
worldmap_chart.title = 'Some countries'
worldmap_chart.render()
Or better :
import pygal
worldmap_chart = pygal.maps.world.World()
worldmap_chart.title = 'Some countries'
worldmap_chart.render()
Depends on what you need to use in pygal
or pygal.maps.world
.
Edit : I tried to render, but nothing appears, one trick is to render in browser which works for me as follow :
import pygal
worldmap_chart = pygal.maps.world.World()
worldmap_chart.title = 'Some countries'
worldmap_chart.force_uri_protocol= "http"
worldmap_chart.add('North America',{'ca': 84949494949,'mx': 494794164,'us': 99794616})
worldmap_chart.render_in_browser()