nltk_book
nltk_book copied to clipboard
Chapter 4 - Section 4.8 A Sample of Python Libraries - SubSection Matplotlib
In the source code showing how to use Agg
backend, you should put in evidence that the chart must be processed between the use of Agg
and the saving of the figure.
import matplotlib
matplotlib.use('Agg')
bar_chart(genres, modals, counts)
pylab.savefig('modals.png')
print('Content-Type: text/html')
print()
print('<html><body>')
print('<img src="modals.png"/>')
print('</body></html>')