Draft
Conversation
Member
|
Really nice graphic :) |
Contributor
|
Awesome graph! So you wrote a function that can create these type of plots? |
Contributor
Author
Yes, I'll copy the code below for reference. I guess it might still need a few tweaks, but you get the idea. import matplotlib.pyplot as plt
def plot_timehandling(prec_start=-1, prec_end=6, target_start=6, target_end=9):
"""Plot time handling given a target and precursor period.
TODO: handle zero-crossing.
"""
prec_start -= 1
prec_end -= 1
target_start -= 1
target_end -= 1
with plt.xkcd():
fig = plt.figure()
ax = fig.add_subplot(111, projection='polar')
ax.set_theta_direction(-1)
ax.set_theta_zero_location('N')
ax.grid(False)
ax.set_axisbelow(False)
ax.set_xticks(np.linspace(0, 2*np.pi*11/12, 12))
ax.set_xticklabels('JFMAMJJASOND')
ax.set_ylim(0, 1)
ax.set_yticks([0, 0.45, 0.85])
ax.set_yticklabels(['1979', '2002', '2018'])
r = np.linspace(0, 12*np.pi, 1000)
th = np.linspace(0, 1, 1000)
ax.plot(r, th, color='lightgrey')
th = np.ones(100)
precursor = np.linspace(prec_start/12, prec_end/12, 100)*np.pi*2
ax.fill_between(precursor, th, 0, color='lightblue', label='precursor')
target = np.linspace(target_start/12, target_end/12, 100)*np.pi*2
ax.fill_between(target, th, 0, color='lightgreen', label='target')
ax.legend(bbox_to_anchor=(1, 1.07))
return fig, ax
fig, ax = plot_timehandling(1, 6, 6, 9) |
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Started running the example notebook and left some notes. Work in progress, I'm about halfway.
In the process I wrote a function that can easily create time handling plots for various precursor/target periods: