|
4 | 4 | ================== |
5 | 5 |
|
6 | 6 | Compare the ellipse generated with arcs versus a polygonal approximation |
| 7 | +
|
| 8 | +.. only:: builder_html |
| 9 | +
|
| 10 | + This example requires :download:`basic_units.py <basic_units.py>` |
7 | 11 | """ |
8 | 12 | from basic_units import cm |
9 | 13 | import numpy as np |
|
12 | 16 |
|
13 | 17 |
|
14 | 18 | xcenter, ycenter = 0.38*cm, 0.52*cm |
15 | | -#xcenter, ycenter = 0., 0. |
16 | 19 | width, height = 1e-1*cm, 3e-1*cm |
17 | 20 | angle = -30 |
18 | 21 |
|
|
33 | 36 |
|
34 | 37 | fig = plt.figure() |
35 | 38 | ax = fig.add_subplot(211, aspect='auto') |
36 | | -ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) |
| 39 | +ax.fill(x, y, alpha=0.2, facecolor='yellow', |
| 40 | + edgecolor='yellow', linewidth=1, zorder=1) |
37 | 41 |
|
38 | 42 | e1 = patches.Ellipse((xcenter, ycenter), width, height, |
39 | 43 | angle=angle, linewidth=2, fill=False, zorder=2) |
|
47 | 51 |
|
48 | 52 |
|
49 | 53 | ax.add_patch(e2) |
50 | | - |
51 | | -#fig.savefig('ellipse_compare.png') |
52 | 54 | fig.savefig('ellipse_compare') |
53 | 55 |
|
54 | 56 | fig = plt.figure() |
55 | 57 | ax = fig.add_subplot(211, aspect='auto') |
56 | | -ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) |
| 58 | +ax.fill(x, y, alpha=0.2, facecolor='yellow', |
| 59 | + edgecolor='yellow', linewidth=1, zorder=1) |
57 | 60 |
|
58 | 61 | e1 = patches.Arc((xcenter, ycenter), width, height, |
59 | 62 | angle=angle, linewidth=2, fill=False, zorder=2) |
|
67 | 70 |
|
68 | 71 |
|
69 | 72 | ax.add_patch(e2) |
70 | | - |
71 | | -#fig.savefig('arc_compare.png') |
72 | 73 | fig.savefig('arc_compare') |
73 | 74 |
|
74 | 75 | plt.show() |
0 commit comments