我有一个从0到5的实体的浮点数据,但我想在图表中显示它们,如
price 3.6
___________
look 3.8
_____________
user friendly 4.3
__________________
reliability 2.3
______
所以在python中有任何包或帮助,或建议吗?
答案 0 :(得分:0)
如果你想要的是用下划线制作的简单条形图,那么可以这样做:
def display(nums,unit = 0.2):
pairs = zip(("price","look","user friendly", "reliability"),nums)
for (label,num) in pairs:
print(label,round(num,1))
print("_" * round(num/unit))
典型输出:
>>> display((3.6,3.8,4.3,2.3))
price 3.6
__________________
look 3.8
___________________
user friendly 4.3
_____________________
reliability 2.3
___________
如果您想要更复杂的图片,请查看imageComparator