bashplotlib icon indicating copy to clipboard operation
bashplotlib copied to clipboard

Making histogram

Open ChopsKingsland opened this issue 4 years ago • 2 comments

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?

ChopsKingsland avatar Jan 11 '21 21:01 ChopsKingsland

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?

notionparallax avatar Jan 22 '22 05:01 notionparallax

x-labels are double spaced but the graph is not?

whillas-yabble avatar Oct 12 '22 23:10 whillas-yabble