awips2/pythonPackages/matplotlib/doc/mpl_examples/api/joinstyle.py
root e2ecdcfe33 Initial revision of AWIPS2 11.9.0-7p5
Former-commit-id: a02aeb236c [formerly 9f19e3f712] [formerly a02aeb236c [formerly 9f19e3f712] [formerly 06a8b51d6d [formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]
Former-commit-id: 06a8b51d6d
Former-commit-id: 8e80217e59 [formerly 3360eb6c5f]
Former-commit-id: 377dcd10b9
2012-01-06 08:55:05 -06:00

31 lines
833 B
Python
Executable file

#!/usr/bin/env python
"""
Illustrate the three different join styles
"""
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def plot_angle(ax, x, y, angle, style):
phi = angle/180*np.pi
xx = [x+.5,x,x+.5*np.cos(phi)]
yy = [y,y,y+.5*np.sin(phi)]
ax.plot(xx, yy, lw=8, color='blue', solid_joinstyle=style)
ax.plot(xx[1:], yy[1:], lw=1, color='black')
ax.plot(xx[1::-1], yy[1::-1], lw=1, color='black')
ax.plot(xx[1:2], yy[1:2], 'o', color='red', markersize=3)
ax.text(x,y+.2,'%.0f degrees' % angle)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('Join style')
for x,style in enumerate((('miter', 'round', 'bevel'))):
ax.text(x, 5, style)
for i in range(5):
plot_angle(ax, x, i, pow(2.0,3+i), style)
ax.set_xlim(-.5,2.75)
ax.set_ylim(-.5,5.5)
plt.show()