When I run this code it doesn't return error but doesn't create a window. Somebody please help.
import pygal as pyg
line_chart = pyg.HorizontalBar()
line_chart.title = 'Friends favorite pizza topping'
line_chart.add('olives', 24)
line_chart.add('TOMATO', 32)
line_chart.add('pepperoni', 42)
line_chart.add('mushroom', 0.5)
line_chart.add('other', 1.5)
line_chart.render()
It generates SVG data which you can assign to variable
and use to embed in HTML or to save in file
or
and later you can open it in browser or viewer.
If you want to see it at once in web browser then you need
There are other
render_....
to generate response forFlask
andDjango
, etc.Maybe if you use
render()
injupyter notebook
orGoogle Colab
(which run in web browser) then it will display it at once.