glamp / bashplotlib Goto Github PK
View Code? Open in Web Editor NEWplotting in the terminal
License: MIT License
plotting in the terminal
License: MIT License
To make the analysis for golang/go#46050 (comment) more meaningful it would be great if the x axis of the histogram could show the bin's values as mentioned in the readme.
Say I have a list such as [1,2,3,4..]. How do I make a histogram out of this list?
Hi,
I'm using Python 3.4.2 and run into the following error when trying to import 'bashplotlib':
ImportError: No module named 'bashplotlib'
It happens when importing it in my project with the example of the README as follows:
from bashplotlib.histogram import plot_hist
I installed the package with the following command:
sudo pip3 install bashplotlib
And it's listed under the installed packaged.
Could you help me with this?
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?
Nice library, but because of prints without parenthesis, doesn't work in python3. I suggest adding print_function future import and using () after all prints to support both 2 and 3.
hello
first sorry my english is not that good , hope you understand
thank you
i tryng to realtime plot two parameter in python
exemple i do have this two parameter , time and a value from a sensor
print 'time ' ,time2
print 'sensor1 ' ,sensor1
this parameter is well 'print'
so i want to plot it
i have tried several conbination , without success
exemple
plot_scatter('',time2,sensor1,3,'','','')
plot_hist(r2, height=20.0, bincount=None, pch='o', colour='white', title='', xlab=None, nosummary='')
can you help me to go on
i am using it in raspberry
I have to confess that I haven't played with your library yet, I just looked at the README on GitHub. Still, your project reminded me of drawille, which is meant to draw stuff on terminal using Unicode Braille characters.
Maybe your project could support such characters in some drawings. Maybe you could link to drawille as a related project that might be useful for other use-cases.
As of the submission of this issue, it seems that bashplotlib can't be installed from pypi via pip in a virtualenv; when I do so, pip attempts to install 0.6.0 but fails with the following error:
IOError: [Errno 2] No such file or directory: 'LICENSE.txt'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/home/lev/Work/virtualenvs/PYTHON/build/bashplotlib/setup.py", line 11, in <module>
license=open("LICENSE.txt").read(),
IOError: [Errno 2] No such file or directory: 'LICENSE.txt'
Moreover, I noticed that pypi appears to list 0.5.3 as a later release than 0.6.0.
"bashplotlib" doesn't figure well what is it, it's not written in bash but in Python.
"pyplotlib" or "asciiplotlib" would be better names.
The option parsing in bin
has gotten out of sync with the module a little bit. A better way to map functions in the bashplotlib
module to system commands is to use entry_points
from setuptools
.
https://pythonhosted.org/setuptools/setuptools.html#automatic-script-creation
I was going through some of the code and attempted to run the texas
program on python 3.5.1 and got:
(bashplotlib) [tijko@arch bin]$ ./texas
File "./texas", line 10
print open(texas).read().strip()
^
SyntaxError: invalid syntax
After installling I am getting following error:
git clone https://github.com/glamp/bashplotlib.git
cd bashplotlib
python setup.py install
bashplotlib]$ hist --demo
Traceback (most recent call last):
File "/usr/bin/hist", line 9, in <module>
load_entry_point('bashplotlib==0.6.3', 'console_scripts', 'hist')()
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 299, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2229, in load_entry_point
return ep.load()
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1948, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/lib/python2.6/site-packages/bashplotlib-0.6.3-py2.6.egg/bashplotlib/histogram.py", line 125
hist = {i: 0 for i in range(len(bins))}
^
SyntaxError: invalid syntax
Currently the LICENSE is not distributed within the tarball. Can you please include the LICENSE in future distributions?
bashplotlib uses a dictionary comprehension, which was added in 2.7 (and 3.0).
On 2.6, this produces a syntax error:
Traceback (most recent call last):
File "/usr/bin/hist", line 6, in <module>
from bashplotlib.histogram import plot_hist
File "/usr/lib/python2.6/site-packages/bashplotlib/histogram.py", line 84
hist = {i: 0 for i in range(len(bins))}
^
SyntaxError: invalid syntax
2.6 is still relatively recent (it is, for instance, the "new" Python available on CentOS 5, as python
is 2.4), so it'd be nice to include support for it.
Here's what I get!
pip 1.4.1 from /usr/lib/python2.7/dist-packages (python 2.7)
: minisub ~tmp%; pip install bashplotlib
Downloading/unpacking bashplotlib
Downloading bashplotlib-0.5.1.tar.gz
Running setup.py egg_info for package bashplotlib
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip_build_danny/bashplotlib/setup.py", line 10, in <module>
license=open("LICENSE.txt").read(),
IOError: [Errno 2] No such file or directory: 'LICENSE.txt'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip_build_danny/bashplotlib/setup.py", line 10, in <module>
license=open("LICENSE.txt").read(),
IOError: [Errno 2] No such file or directory: 'LICENSE.txt'
Shall i implement unicode to make it beatifull, also wanted to know if this project is dead
Hello,
I'm looking for a python script to draw candlestick plot inside a text user interface (ncurses or urwid).
Could you help me to do that ?
For now I've done a script which download from Yahoo Finance
GOOG OHLCV data (and put data into a SQLite cache)
You need pandas, requests and requests-cache
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import requests_cache
expire_after = None #15*60 # expire_after=delay_second or None
requests_cache.install_cache('req_cache', backend='sqlite', expire_after=expire_after)
from StringIO import StringIO
import pandas as pd
def get_ohlcv_data(size, offset=0):
url = "http://ichart.finance.yahoo.com/table.csv?s=GOOG"
req = requests.get(url)
#print(req.content)
io = StringIO(req.content)
df = pd.read_csv(io, sep=',', parse_dates=['Date'])
df = df.rename(columns={
'Date': 'date',
'Open': 'open',
'High': 'high',
'Low': 'low',
'Close': 'close',
'Volume': 'volume',
'Adj Close': 'adj close',
})
df = df.set_index('date')
df = df[offset:size+offset][::-1]
return(df)
def main():
df = get_ohlcv_data(50, 0)
print(df)
print(df.dtypes)
inc = df['close'] > df['open']
dec = df['close'] < df['open']
if __name__ == "__main__":
main()
An other sofware provide something similar
http://prof7bit.github.io/goxtool/
but I really want to isolate plot to be standalone.
It will be nice if bashplotlib could provide such feature.
Kind regards
I think it'd be nice and not really complicated to add support to plot from two variables in lists/np.array's. This would be useful when e.g. debugging in a command-line in a remote server.
I can contribute if no one else volunteers to do it and the authors agree on adding this
I'm getting the following errors when trying to build using Python3.8
davidjackson@VirtualBox:/bashplotlib$ python3 setup.py install/bashplotlib$
Traceback (most recent call last):
File "setup.py", line 3, in
from setuptools import find_packages, setup
ModuleNotFoundError: No module named 'setuptools'
davidjackson@VirtualBox:
In a virtualenv:
$ pip install bashplotlib
$ ... | hist
...
ImportError: No module named bashplotlib.histogram
Here is my environment on a Ubuntu 12.04:
$ python --version
Python 2.7.6
$ pip --version
pip 1.5.6 from /var/local/virtualenvs/ipython/local/lib/python2.7/site-packages (python 2.7)
$ pip uninstall bashplotlib
Uninstalling bashplotlib:
/var/local/virtualenvs/ipython/bin/hist
/var/local/virtualenvs/ipython/bin/scatter
/var/local/virtualenvs/ipython/lib/python2.7/site-packages/bashplotlib-0.6.4-py2.7.egg-info
It looks like there should be directory /var/local/virtualenvs/ipython/lib/python2.7/site-packages/bashplotlib
but there isn't.
Hi
I wish I could do some "live" ploting. Let's say I'm migrating stuff from server, I'ld like to keep an eye on disk space, I'ld like to do something like
while true; do sleep 1; df -k / --output=used | tail -n1; done | hist -n
Or maybe
hist --command 'df -k / --output=used | tail -n1'
Which would draw a simple plot "in place", I mean refreshing it instead of a new one. With a couple of option like rate (plot every X seconds), and horizontal rule (in my example, a value I don't wanna cross)
I know nowadays it's all about prometheus grafana etc, but a good CLI tool is still priceless for smaller team
Best regards,
Should read boolean rather than boolen.
The documentation in the README shows nosummary
as a keyword argument for plot_hist
, but it seems as though this was changed to showSummary
(and the meaning of the flag inverted). Not sure if there are other inconsistencies.
Observe:
[$]> git shortlog -s -n | awk '{print $1}' | hist --nosummary
33| o
32| o
30| o
28| o
27| o
25| o
23| o
22| o
20| o
18| o
16| o
15| o
13| o
11| o
10| o
8| o
6| o
5| o
3| o o o
1| o o o o o
0| o o o o o o o
----------------------
-----------------------
| Summary |
-----------------------
| observations: 50 |
| min value: 1.000000 |
| mean : 519.140000 |
|max value: 3207.000000|
-----------------------
Hi and thanks for this very useful tiny tool!
In addition to min/mean/max, could you also add the median to the hist summary?
The way the labels for the x-axis in histogram.py adds twice as many spaces as required and makes the graph look skewed.
Hello,
I've seen Bashplotlib.
it seems this piece of software is inactive since long ago.
is it right?
Thanks
Hello,
I just send you this message to say you that OptParse is now deprecated
http://docs.python.org/2/library/optparse.html
You should use ArgParse
http://docs.python.org/2/library/argparse.html#module-argparse
Some other python command line parsers are
docopt http://docopt.org/
docstring oriented
clize https://pypi.python.org/pypi/clize/
decorator oriented
argh https://pythonhosted.org/argh/
see also https://pythonhosted.org/argh/similar.html
Kind regards
My shell (ksh93) informs me that
$ type -a hist
hist is a shell builtin
hist is /Library/Frameworks/Python.framework/Versions/3.6/bin/hist
hist is an undefined function
in other words, if I try to run hist
I will get the shell builtin first. I can circumvent that by using the env
program, but this is not obvious right away.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.