Python数据可视化 Python数据可视化实现多种图例代码详解
吃着东西不想停 人气:0前言
本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理。
from math import pi import matplotlib.pyplot as plt cat = ['Speed', 'Reliability', 'Comfort', 'Safety', 'Effieciency'] values = [90, 60, 65, 70, 40] N = len(cat) x_as = [n / float(N) * 2 * pi for n in range(N)] ax = plt.subplot(111) plt.xticks(x_as) ax.plot(x_as, values, linewidth=1, linestyle='solid', zorder=3) plt.show()
import matplotlib.pyplot as plt from palettable.colorbrewer.qualitative import Pastel1_7 my_dpi=96 plt.figure(figsize=(480/my_dpi, 480/my_dpi), dpi=my_dpi) names='groupA', 'groupB', 'groupC', 'groupD', size=[12,11,3,30] my_circle=plt.Circle( (0,0), 0.7, color='white') plt.pie(size, labels=names, colors=Pastel1_7.hex_colors) p=plt.gcf() p.gca().add_artist(my_circle) plt.show()
import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame([8,8,1,2], index=['a', 'b', 'c', 'd'], columns=['x']) my_dpi=96 plt.figure(figsize=(480/my_dpi, 480/my_dpi), dpi=my_dpi) df.plot(kind='pie', subplots=True, figsize=(8, 8)) plt.show()
加载全部内容