bashplotlib
bashplotlib copied to clipboard
Making histogram
I am trying to display a histogram, and it doesn't work, but instead prints -----------... My code is
with open("cpuhistory.txt", "r") as n:
plot_hist(n)
n.close()
and cpuhistory.txt is https://pastebin.com/vPMBTxzJ .
How can I get it working?
The following code works for me with your data:
from bashplotlib.histogram import plot_hist
with open("cpuhistory.txt", "r") as n:
plot_hist(
list(n),
height=10,
xlab=True,
showSummary=True,
bincount=20,
)
which gives:
24| o
21| o
19| o
16| o
14| oo
11| ooo
8| ooo
6| ooo
3| oooo
1| oooooo o o
---------------------
1 2 3 4 5 6 7 9 1 1 1
. . . . . . . . 0 1 2
5 5 6 7 7 8 9 0 . . .
0 8 5 2 9 6 3 0 0 1 2
----------------------------------
| Summary |
----------------------------------
| observations: 61 |
| min value: 1.509434 |
| mean : 2.683872 |
| max value: 12.218891 |
----------------------------------
It also works without the extra args.
It's not possible that it was scrolling the rest of the histogram off the screen is it?
x-labels are double spaced but the graph is not?