seaborn
Seaborn其实是在matplotlib的基础上进行了更高级的API封装,从而使得作图更加容易,在大多数情况下使用seaborn就能做出很具有吸引力的图,而使用matplotlib就能制作具有更多特色的图。应该把Seaborn视为matplotlib的补充,而不是替代物。
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt fake = pd.DataFrame({'cat': ['red', 'green', 'blue'], 'val': [1, 2, 3]}) print(fake) ax = sns.barplot(x = 'val', y = 'cat', data = fake, color = 'black') ax.set(xlabel='common xlabel', ylabel='common ylabel') plt.show()