#! /usr/bin/env python3 # def bulgaria_interactive ( ): #*****************************************************************************80 # ## bulgaria_interactive plots the population of Bulgaria over time. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 08 November 2019 # # Author: # # John Burkardt # import matplotlib.pyplot as plt import numpy as np import platform import warnings print ( '' ) print ( 'bulgaria_interactive:' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' Plot the population of Bulgaria over time.' ) warnings.simplefilter ( 'ignore' ) # # Read the pairs "Year, Population" from the data file. # filename = 'bulgaria_data.txt' data = np.loadtxt ( filename ) # # Split the data into separate year and population vectors. # year = data[:,0] population = data[:,1] # # Plot the data. # plt.plot ( year, population, linewidth = 3, color = 'b' ) plt.grid ( True ) plt.xlabel ( '<--- Year --->', fontsize = 16 ) plt.ylabel ( '<--- Population --->', fontsize = 16 ) plt.title ( 'The Population of Bulgaria', fontsize = 16 ) # # Display the plot on the screen. # plt.show ( ) # # Terminate. # print ( '' ) print ( 'bulgaria_interactive' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): bulgaria_interactive ( )