Created
February 26, 2012 11:34
-
-
Save twpayne/1916209 to your computer and use it in GitHub Desktop.
Weight ranges and availability for hot EN D gliders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| SHIPPING = 'S' | |
| AVAILABLE_FOR_ORDER = 'A' | |
| PLANNED = 'P' | |
| PARAGLIDERS = [ | |
| ('EnZo S', 90, 105, SHIPPING), | |
| ('EnZo M', 100, 115, SHIPPING), | |
| ('EnZo L', 110, 125, SHIPPING), | |
| ('Icepeak 6 21', 70, 90, SHIPPING), | |
| ('Icepeak 6 23', 85, 105, SHIPPING), | |
| ('Icepeak 6 24', 95, 115, SHIPPING), | |
| ('Icepeak 6 26', 105, 125, SHIPPING), | |
| ('Core 3 22', 85, 102, SHIPPING), | |
| ('Core 3 23', 95, 112, SHIPPING), | |
| ('Core 3 24', 108, 121, SHIPPING), | |
| ('Boomerang 9 M', 95, 115, SHIPPING), | |
| ('Axis Mercury Sport S', 88, 102, SHIPPING), | |
| ('Axis Mercury Sport M', 102, 118, SHIPPING), | |
| ('Dudek Coden 25.5', 100, 120, SHIPPING), | |
| ] | |
| LCOLORS = { | |
| PLANNED: '#dddddd', | |
| AVAILABLE_FOR_ORDER: '#cccccc', | |
| SHIPPING: '#200772' | |
| } | |
| RCOLORS = { | |
| PLANNED: '#cccccc', | |
| AVAILABLE_FOR_ORDER: '#bbbbbb', | |
| SHIPPING: '#6a48d7' | |
| } | |
| def chart(i, paragliders, filename): | |
| plt.figure(i) | |
| plt.title('Weight ranges and availability') | |
| plt.xlabel('All-up weight') | |
| plt.grid(True) | |
| plt.axvline(95) | |
| plt.axvline(115) | |
| for i, p in enumerate(paragliders): | |
| label, lower, upper, state = p | |
| plt.barh(i + 0.25, (upper - lower) / 2.0, 0.5, lower, color=LCOLORS[state], linewidth=0) | |
| plt.barh(i + 0.25, (upper - lower) / 2.0, 0.5, lower + (upper - lower) / 2.0, color=RCOLORS[state], linewidth=0) | |
| plt.text((upper + lower) / 2.0, i + 0.5, label, ha='center', va='center', fontsize=9, color='#ffffff') | |
| plt.axis([70, 130, 0, len(PARAGLIDERS)]) | |
| plt.axes().get_yaxis().set_visible(False) | |
| plt.savefig(filename) | |
| chart(1, PARAGLIDERS, 'hot-ends-by-manufacturer.png') | |
| chart(2, sorted(PARAGLIDERS, key=lambda p: (p[2] + p[1]) / 2.0), 'hot-ends-by-weight-range.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment