GeezerVison is showing github.com — updated usage · Aluriak/bashplotlib@da60206
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bashplotlib/histogram.py +16-13Lines changed: 16 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ def run_demo(): | 50 | 50 | print "hist -f ./data/exp.txt -s 35.0 -b 40" | 51 | 51 | plot_hist('./data/exp.txt', height=35.0, bincount=40) | 52 | 52 |
| 53 | | -def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", xlab=None): | | 53 | +def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", xlab=None, nosummary=True): | 54 | 54 | "plot a histogram given a file of numbers" | 55 | 55 | if pch is None: | 56 | 56 | pch = "o" | @@ -121,16 +121,18 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", | 121 | 121 | print | 122 | 122 | center = max(map(len, map(str, [n, min_val, mean, max_val]))) | 123 | 123 | center += 15 | 124 | | - print | 125 | | - print "-"*(2 + center) | 126 | | - print "|" + "Summary".center(center) + "|" | 127 | | - print "-"*(2 + center) | 128 | | - summary = "|" + ("observations: %d" % n).center(center) + "|\n" | 129 | | - summary += "|" + ("min value: %f" % min_val).center(center) + "|\n" | 130 | | - summary += "|" + ("mean : %f" % mean).center(center) + "|\n" | 131 | | - summary += "|" + ("max value: %f" % max_val).center(center) + "|\n" | 132 | | - summary += "-"*(2 + center) | 133 | | - print summary | | 124 | + | | 125 | + if nosummary is not True: | | 126 | + print | | 127 | + print "-"*(2 + center) | | 128 | + print "|" + "Summary".center(center) + "|" | | 129 | + print "-"*(2 + center) | | 130 | + summary = "|" + ("observations: %d" % n).center(center) + "|\n" | | 131 | + summary += "|" + ("min value: %f" % min_val).center(center) + "|\n" | | 132 | + summary += "|" + ("mean : %f" % mean).center(center) + "|\n" | | 133 | + summary += "|" + ("max value: %f" % max_val).center(center) + "|\n" | | 134 | + summary += "-"*(2 + center) | | 135 | + print summary | 134 | 136 |
| 135 | 137 |
| 136 | 138 | if __name__=="__main__": | @@ -150,9 +152,10 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", | 150 | 152 | parser.add_option('-c', '--colour', help='colour of the plot (%s)' % ", ".join([c for c in bcolours.keys() if c != 'ENDC']), | 151 | 153 | default='white', dest='colour') | 152 | 154 | parser.add_option('-d', '--demo', help='run demos', action='store_true', dest='demo') | | 155 | + parser.add_option('-n', '--nosummary', help='run demos', action='store_true', dest='nosummary') | 153 | 156 |
| 154 | 157 | (opts, args) = parser.parse_args() | 155 | | - | | 158 | + | 156 | 159 | if opts.f is None: | 157 | 160 | if len(args) > 0: | 158 | 161 | opts.f = args[0] | @@ -162,7 +165,7 @@ def plot_hist(f, height=20.0, bincount=None, pch="o", colour="white", title="", | 162 | 165 | if opts.demo: | 163 | 166 | run_demo() | 164 | 167 | elif opts.f: | 165 | | - plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t, opts.x) | | 168 | + plot_hist(opts.f, opts.h, opts.b, opts.p, opts.colour, opts.t, opts.x, opts.nosummary) | 166 | 169 | else: | 167 | 170 | print "nothing to plot!" | 168 | 171 |
|
Collapse file Copy file name to clipboard +17-2Lines changed: 17 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 |
| 2 | 2 | hist = { | 3 | | - "usage": "this is a histogram" | | 3 | + "usage": """hist is a command for making histograms. it accepts a series of values in one of the following formats: | | 4 | + 1) txt file w/ 1 column of numbers | | 5 | + 2) standard in piped from another command line cat or curl | | 6 | + | | 7 | + for some examples of how to use hist, you can type the command: | | 8 | + hist --demo | | 9 | + or visit https://github.com/glamp/bashplotlib/blob/master/examples/sample.sh | | 10 | + """ | 4 | 11 | } | 5 | 12 |
| 6 | 13 | scatter = { | 7 | | - "usage": "this is a scatterplot" | | 14 | + "usage": """scatterplot is a command for making xy plots. it accepts a series of x values and a series of y values in the | | 15 | + following formats: | | 16 | + 1) a txt file or standard in value w/ 2 comma seperated columns of x,y values | | 17 | + 2) 2 txt files. 1 w/ designated x values and another with designated y values. | | 18 | + | | 19 | + scatter -x <xcoords> -y <ycoords> | | 20 | + cat <file_with_x_and_y_coords> | scatter | | 21 | +
| | 22 | + """ | 8 | 23 | } | 9 | 24 |
|
Collapse file Copy file name to clipboard Collapse file Copy file name to clipboardExpand all lines: setup.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 |
| 4 | 4 | setup( | 5 | 5 | name="bashplotlib", | 6 | | - version="0.3.4", | | 6 | + version="0.3.5", | 7 | 7 | author="Greg Lamp", | 8 | 8 | | 9 | 9 | url="https://github.com/glamp/bashplotlib", | 10 | 10 | license=open("LICENSE.txt").read(), | 11 | 11 | packages=find_packages(), | 12 | | - description="plotting from the command line", | | 12 | + description="plotting in the terminal", | 13 | 13 | long_description=open("README.txt").read(), | 14 | 14 | scripts=['bin/hist', 'bin/scatter'], | 15 | 15 | ) | |
|