Show More
@@ -22,7 +22,7 b' from matplotlib import (' | |||
|
22 | 22 | ) |
|
23 | 23 | |
|
24 | 24 | |
|
25 | def plot(data): | |
|
25 | def plot(data, title=None): | |
|
26 | 26 | items = {} |
|
27 | 27 | re_title = re.compile(r'^revisions #\d+ of \d+, rev (\d+)$') |
|
28 | 28 | for item in data: |
@@ -108,6 +108,8 b' def plot(data):' | |||
|
108 | 108 | else: |
|
109 | 109 | legline.set_alpha(0.2) |
|
110 | 110 | fig.canvas.draw() |
|
111 | if title is not None: | |
|
112 | fig.canvas.set_window_title(title) | |
|
111 | 113 | fig.canvas.mpl_connect('pick_event', onpick) |
|
112 | 114 | |
|
113 | 115 | plt.show() |
@@ -119,7 +121,7 b" if __name__ == '__main__':" | |||
|
119 | 121 | if len(sys.argv) > 1: |
|
120 | 122 | print('reading from %r' % sys.argv[1]) |
|
121 | 123 | with open(sys.argv[1], 'r') as fp: |
|
122 | plot(json.load(fp)) | |
|
124 | plot(json.load(fp), title=sys.argv[1]) | |
|
123 | 125 | else: |
|
124 | 126 | print('reading from stdin') |
|
125 | 127 | plot(json.load(sys.stdin)) |
General Comments 0
You need to be logged in to leave comments.
Login now