命令行条形图

pyplotter的Python项目详细描述


安装

pip install pyplotter

用法

命令行

pyplotter 1 2 3 4 5
pyplotter 1 2 3 4 5 --show-min-max --padding 1 --title testing --height 3
pyplotter -h

在python外壳内部

import pyplotter as pyplotter
data = range(1, 22)
labels = map(str, data)
title = "My cool graph"
graph = pyplotter.Graph(data=data, labels=labels, title=title)
pyplotter.Plotter.plot(graph, show_x_axis=False, padding=1)
My cool graph
                    ▁ ▁ ▂ ▂ ▃ ▄ ▄ ▅ ▆ ▆ ▇   -- Max: 21
▁ ▂ ▂ ▃ ▄ ▄ ▅ ▆ ▆ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇   -- Min 1
Data range: 1 - 21

pyplotter.Plotter.plot(graph, show_x_axis=True, tail=5)  # last 5 elements
My cool graph
                    ▁         ▄         ▇   -- Max: 21
▁         ▄         ▇         ▇         ▇   -- Min 17
<17>[17]  <18>[18]  <19>[19]  <20>[20]  <21>[21]
Data range: 17 - 21

多个显示选项

help(pyplotter.Plotter.plot)
plot(graph, show_x_axis=True, head=None, tail=None, label_length=4, padding=0, height=2, show_min_max=True, show_data_range=True, show_title=True)
    show_x_axis: Display X axis
    head: Show first [head:] elements
    tail: Show last [-tail:] elements
    padding: Padding size between columns (default 0)
    height: Override graph height
    label_length: Force X axis label string size, may truncate label
    show_min_max: Display Min and Max values on the left of the graph
    show_title: Display graph title (if any)
    show_data_range: Display X axis data range

pyplotter.Plotter.plot(graph, show_x_axis=False, padding=1, height=10)
Another example
                                            ▇       ▁         -- Max: 50
▃                       ▄   ▅               ▇       ▇
▇     ▁           ▁     ▇   ▇ ▇       ▂ ▇   ▇     ▁ ▇   ▇
▇     ▇     ▆ ▆   ▇ ▄   ▇   ▇ ▇     ▅ ▇ ▇   ▇     ▇ ▇   ▇
▇     ▇     ▇ ▇   ▇ ▇   ▇   ▇ ▇     ▇ ▇ ▇ ▆ ▇ ▂ ▁ ▇ ▇   ▇
▇     ▇     ▇ ▇   ▇ ▇   ▇   ▇ ▇     ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇   ▇
▇   ▄ ▇   ▇ ▇ ▇   ▇ ▇   ▇   ▇ ▇     ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▂ ▇
▇   ▇ ▇ ▆ ▇ ▇ ▇ ▄ ▇ ▇ ▇ ▇ ▄ ▇ ▇     ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇
▇ ▃ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇     ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇
▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▄ ▁ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇ ▇   -- Min 2

注释

  • 当标记文件显示为HTML时,条形图不会对齐 由于空间

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在一个问题被连续正确回答三次/并添加差异后,我如何将程序循环回开始   Java中未实例化的匿名类   java如何在Android中录制视频,只允许横向模式和最长时间录制时间   java从另一个活动发送实时消息   多线程java线程和互斥   java禁用Spring安全日志   JAVA伊奥。StreamCorruptedException:在与子级和父级ProcessBuilder通信时写入子级中的标准输出时,流头无效   使用Java(HttpURLConnection)对Restheart进行身份验证(对于Mongodb)   java如何解决Jenkins中的SAXParseException?   java为什么我需要mockito来测试Spring应用程序?   计算sin-cos和tan时缺乏精度(java)   java Hibernate。不同项目中相同一对一映射的不同行为   java图像滑块:如何使用JavaFX将图像放在另一个图像上   java Mockito在使用when时抛出NotAMockException   http Java servlet发送回响应