bar chart with Matplotlib
问题 Here is my data structure: data = {'2013': {1:25,2:81,3:15}, '2014': {1:28, 2:65, 3:75}, '2015': {1:78,2:91,3:86 }} My x-axis is the number [1,2,3] My y-axis is the quantity of each number. For example: In 2013, 1 is x axis while its quantity is 25 . Print each individual graph for each year I would like to graph a bar chart, which uses matplotlib with legend on it. 回答1: import matplotlib.pyplot as plt import pandas as pd data = {'2013': {1:25,2:81,3:15}, '2014': {1:28, 2:65, 3:75}, '2015':