Demonstrate how each JoinStyle looks for various join angles.
()
| 75 | |
| 76 | @staticmethod |
| 77 | def demo(): |
| 78 | """Demonstrate how each JoinStyle looks for various join angles.""" |
| 79 | import numpy as np |
| 80 | import matplotlib.pyplot as plt |
| 81 | |
| 82 | def plot_angle(ax, x, y, angle, style): |
| 83 | phi = np.radians(angle) |
| 84 | xx = [x + .5, x, x + .5*np.cos(phi)] |
| 85 | yy = [y, y, y + .5*np.sin(phi)] |
| 86 | ax.plot(xx, yy, lw=12, color='tab:blue', solid_joinstyle=style) |
| 87 | ax.plot(xx, yy, lw=1, color='black') |
| 88 | ax.plot(xx[1], yy[1], 'o', color='tab:red', markersize=3) |
| 89 | |
| 90 | fig, ax = plt.subplots(figsize=(5, 4), constrained_layout=True) |
| 91 | ax.set_title('Join style') |
| 92 | for x, style in enumerate(['miter', 'round', 'bevel']): |
| 93 | ax.text(x, 5, style) |
| 94 | for y, angle in enumerate([20, 45, 60, 90, 120]): |
| 95 | plot_angle(ax, x, y, angle, style) |
| 96 | if x == 0: |
| 97 | ax.text(-1.3, y, f'{angle} degrees') |
| 98 | ax.set_xlim(-1.5, 2.75) |
| 99 | ax.set_ylim(-.5, 5.5) |
| 100 | ax.set_axis_off() |
| 101 | fig.show() |
| 102 | |
| 103 | |
| 104 | JoinStyle.input_description = "{" \ |
nothing calls this directly
no test coverage detected