答案 0 :(得分:2)
我认为您想要使用的是条形图。直方图用于检查数值数据的分布。以下是我将如何实现它:
import matplotlib.pyplot as plt
import education
list_of_record = education.get_all_states
virginia_education = education.get_state('Virginia')
enrollment = virginia_education["enrollment"]
students = enrollment["students"]
race = students["race"]
x = range(len(race)) # x-axis list
label = [] # x-labels list
y = [] # y-values list
for race, value in race.items():
label.append(race) # add race to x-labels list
y.append(value) # add value to y-values list
plt.bar(x,y,color='indianred',tick_label=label,align='center')
plt.show()