Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making histogram #59

Open
ChopsKingsland opened this issue Jan 11, 2021 · 2 comments
Open

Making histogram #59

ChopsKingsland opened this issue Jan 11, 2021 · 2 comments

Comments

@ChopsKingsland
Copy link

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?

@notionparallax
Copy link

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?

@whillas-yabble
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants