MCPcopy Index your code
hub / github.com/glamp/bashplotlib / run_demo

Function run_demo

bashplotlib/histogram.py:50–88  ·  view source on GitHub ↗

Run a demonstration

()

Source from the content-addressed store, hash-verified

48
49
50def run_demo():
51 """
52 Run a demonstration
53 """
54 module_dir = dirname(dirname(os.path.realpath(__file__)))
55 demo_file = os.path.join(module_dir, 'examples/data/exp.txt')
56
57 if not os.path.isfile(demo_file):
58 sys.stderr.write("demo input file not found!\n")
59 sys.stderr.write("run the downloaddata.sh script in the example first\n")
60 sys.exit(1)
61
62 # plotting a histogram
63 print("plotting a basic histogram")
64 print("plot_hist('%s')" % demo_file)
65 print("hist -f %s" % demo_file)
66 print("cat %s | hist" % demo_file)
67 plot_hist(demo_file)
68 print("*" * 80)
69
70 # with colours
71 print("histogram with colours")
72 print("plot_hist('%s', colour='blue')" % demo_file)
73 print("hist -f %s -c blue" % demo_file)
74 plot_hist(demo_file, colour='blue')
75 print("*" * 80)
76
77 # changing the shape of the point
78 print("changing the shape of the bars")
79 print("plot_hist('%s', pch='.')" % demo_file)
80 print("hist -f %s -p ." % demo_file)
81 plot_hist(demo_file, pch='.')
82 print("*" * 80)
83
84 # changing the size of the plot
85 print("changing the size of the plot")
86 print("plot_hist('%s', height=35.0, bincount=40)" % demo_file)
87 print("hist -f %s -s 35.0 -b 40" % demo_file)
88 plot_hist(demo_file, height=35.0, bincount=40)
89
90
91def plot_hist(f, height=20.0, bincount=None, binwidth=None, pch="o", colour="default", title="", xlab=None, showSummary=False, regular=False):

Callers 1

mainFunction · 0.85

Calls 1

plot_histFunction · 0.85

Tested by

no test coverage detected