Python - Create Bar Chart Using Matplotlib
by matt392 in Circuits > Software
36 Views, 1 Favorites, 0 Comments
Python - Create Bar Chart Using Matplotlib


import matplotlib.pyplot as mattexample print ("Imported matplotlib") # x axis values x = [2, 4, 6, 8, 10, 12, 14, 16] # y axis y = [7, 5, 8, 6, 7, 8, 10, 14] print("The x-axis values are: ", x) print("The y-axis values are: ", y) # Invoke bar function to generate bar graph print ("Now invoking the bar function.") mattexample.bar(x,y) # Invoke the show function to display the bar graph print ("Now showing the bar graph that was generated.") mattexample.show()