# File: Exercise2_2.py (Chapter 2, Execise 2) # Purpose: generate a series of bar charts that compare drug use thru time # Author: Emily G. Allen # Import pylab from pylab import * # Import drug data from DrugData import * def drugBar(): hold(1) # hold the figure so all bar graphs plot # plot the bars bar(Year, Alcohol, color = 'k') bar(Year, Cigarettes, color = 'y') bar(Year, Marijuana, color = 'r') bar(Year, Cocaine, color ='g') # label the graph xlabel('Time') ylabel('Percentage of Students') title('Alcohol, Cigarettes, Marijuana, and Cocaine Use by Seniors over Time') show() # show the figure