ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since f6fd42aa was
c04a19e,
checked in by Thierry Delisle <tdelisle@…>, 4 years ago
|
Major update to chapter 3
|
-
Property mode set to
100644
|
File size:
944 bytes
|
Line | |
---|
1 | import matplotlib.pyplot as plt |
---|
2 | import numpy as np |
---|
3 | |
---|
4 | import sys |
---|
5 | |
---|
6 | if __name__ == "__main__": |
---|
7 | if len(sys.argv) > 2: |
---|
8 | print('USAGE: %s [FILE]' % sys.argv[0], file=sys.stderr) |
---|
9 | sys.exit(1) |
---|
10 | |
---|
11 | with plt.xkcd(): |
---|
12 | fig = plt.figure() |
---|
13 | ax = fig.add_axes((0.1, 0.2, 0.8, 0.7)) |
---|
14 | ax.spines['right'].set_color('none') |
---|
15 | ax.spines['top'].set_color('none') |
---|
16 | ax.set_xticks([]) |
---|
17 | ax.set_yticks([]) |
---|
18 | ax.set_ylim([-30, 10]) |
---|
19 | |
---|
20 | x = np.linspace(1, 100, 100) |
---|
21 | |
---|
22 | fair = ((x / 15) ** 2) - 28 |
---|
23 | ax.annotate('Fairness', xy=(70, 1), xytext=(80, 1)) |
---|
24 | ax.plot(fair) |
---|
25 | |
---|
26 | local = (((x - 100) / 17.5) ** 2) - 28 |
---|
27 | ax.annotate('Locality', xy=(70, 1), xytext=(1, 1)) |
---|
28 | ax.plot(local, color='r') |
---|
29 | |
---|
30 | ax.set_xlabel('Ready Time') |
---|
31 | ax.set_ylabel('Importance') |
---|
32 | if len(sys.argv) == 1: |
---|
33 | plt.show() |
---|
34 | else : |
---|
35 | plt.rcParams["savefig.format"] = "svg" |
---|
36 | plt.rcParams["savefig.bbox"] = "tight" |
---|
37 | plt.rcParams["svg.fonttype"] = 'none' |
---|
38 | plt.savefig(sys.argv[1], format="svg") |
---|
Note: See
TracBrowser
for help on using the repository browser.