David Blume commited on 2019-02-03 19:33:36
Showing 2 changed files, with 11 additions and 6 deletions.
... | ... |
@@ -22,7 +22,7 @@ You specify one of four renderers, and it analyzes (currently) some hardcoded da |
22 | 22 |
|
23 | 23 |
Here's the help text: |
24 | 24 |
|
25 |
- usage: make\_chart.py [\-h] [-r {none,gnuplot,matplotlib,google}] |
|
25 |
+ usage: make_chart.py [-h] [-r {none,gnuplot,matplotlib,google}] |
|
26 | 26 |
|
27 | 27 |
Makes histograms from raw samples or prepared buckets. |
28 | 28 |
|
... | ... |
@@ -158,7 +158,8 @@ def main(renderer): |
158 | 158 |
ax.yaxis.grid(linestyle='--', alpha=0.4) |
159 | 159 |
ax.xaxis.grid(linestyle='--', alpha=0.4) |
160 | 160 |
plt.title(f"Histogram of sample data less outter {outlier_percentile}%") |
161 |
- plt.figtext(0.14, 0.82, f'median = {median:,.2f}\nmean = {mean:,.2f} sdev={std_dev:,.2f}') |
|
161 |
+ plt.figtext(0.14, 0.82, f'median = {median:,.2f}\n' |
|
162 |
+ f'mean = {mean:,.2f} sdev={std_dev:,.2f}') |
|
162 | 163 |
plt.xlabel("Pizzas") |
163 | 164 |
plt.ylabel("Count of samples") |
164 | 165 |
pngname = os.path.splitext(filename)[0] + '.png' |
... | ... |
@@ -176,7 +177,8 @@ def main(renderer): |
176 | 177 |
f.write(f'["{x[i]:,} Pizzas", {y[i]}],\n') |
177 | 178 |
elif line.find('REPLACE_ME_WITH_OVERVIEW') != -1: |
178 | 179 |
f.write(f'<h3>{filename} less outter {outlier_percentile}%</h3>\n') |
179 |
- f.write(f'median = {median:,.3f} Pizzas<br />\nmean = {mean:,.3f} σ={std_dev:,.3f} Pizzas<br />\n') |
|
180 |
+ f.write(f'median = {median:,.3f} Pizzas<br />\n' |
|
181 |
+ f'mean = {mean:,.3f} σ={std_dev:,.3f} Pizzas<br />\n') |
|
180 | 182 |
elif line.find('NUMBER_ROWS') != -1: |
181 | 183 |
f.write(line.replace('NUMBER_ROWS', str(len(x))) + '\n') |
182 | 184 |
elif line.find('SET_SHOWTEXTEVERY') != -1: |
... | ... |
@@ -192,7 +194,8 @@ def main(renderer): |
192 | 194 |
gnuplot_path = '/usr/bin/gnuplot' |
193 | 195 |
with subprocess.Popen([gnuplot_path], stdin=subprocess.PIPE, encoding='utf8') as gnuplot: |
194 | 196 |
gnuplot.stdin.write("set term dumb `tput cols` `tput lines`*2/3\n") |
195 |
- gnuplot.stdin.write(f'set label "median = {median:,.2f}\\nmean = {mean:,.2f} sdev={std_dev:,.2f}" at graph 0.03, 0.9\n') |
|
197 |
+ gnuplot.stdin.write(f'set label "median = {median:,.2f}\\n' |
|
198 |
+ f'mean = {mean:,.2f} sdev={std_dev:,.2f}" at graph 0.03, 0.9\n') |
|
196 | 199 |
gnuplot.stdin.write("plot '-' using 1:2 title 'Pizzas' with linespoints \n") |
197 | 200 |
for i, j in zip(x, y): |
198 | 201 |
gnuplot.stdin.write("%f %f\n" % (i, j)) |
... | ... |
@@ -203,8 +206,10 @@ def main(renderer): |
203 | 206 |
|
204 | 207 |
if __name__ == '__main__': |
205 | 208 |
parser = ArgumentParser(description='Makes histograms from raw samples or prepared buckets.') |
206 |
- parser.add_argument('-r', '--renderer', choices=['none', 'gnuplot', 'matplotlib', 'google'], |
|
207 |
- default='gnuplot', help='Choose a renderer: summary only, text, png, or webpage.') |
|
209 |
+ parser.add_argument('-r', '--renderer', |
|
210 |
+ choices=['none', 'gnuplot', 'matplotlib', 'google'], |
|
211 |
+ default='gnuplot', |
|
212 |
+ help='Choose a renderer: summary only, text, png, or webpage.') |
|
208 | 213 |
args = parser.parse_args() |
209 | 214 |
if args.renderer == "matplotlib": |
210 | 215 |
import matplotlib.pyplot as plt |
211 | 216 |