-
Notifications
You must be signed in to change notification settings - Fork 7
Calendar visualizations using bokeh
#107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Note that the linter fails only because of a known mypy bug (python/mypy#13627) |
Can we suppress the linter for that line, and add a comment to the bug report? Ideally, we should avoid accepting red CI, orwe might get sloppy and stop checking it because it wasn't green to start with. |
Working on some refactoring and streamlining of the code, along with adding your (live) suggestions 👍 |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
notebooks/tutorial_time.ipynb
Outdated
@@ -272,6 +272,62 @@ | |||
"larger_calendar.visualize(add_freq=True)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be fixed. It runs well locally on my machine. I think you haven't updated/run this notebook after changing your code. It must be from .bokeh_plots import bokeh_visualization
, which is correct in your code. Just run it again.
Reply via ReviewNB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this seems to have gone wrong. Thanks for noticing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! The implementation is also quite elegant. Only for the file plot.py
, I think the user doesn't need it and it can also be a hidden thingy, just like _bokeh_plots.py
.
Changes are approved. Just feel free to merge it to main after addressing the minor comments. Thanks for the nice work!
s2spy/_base_calendar.py
Outdated
n_years = min(n_years, len(self.get_intervals().index)) | ||
plot.matplotlib_visualization(self, n_years, add_freq) | ||
|
||
def visualize_bokeh( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
visualize_bokeh
sounds a bit implicit, especially for the user not familiar with bokeh
. I prefer a more explicit method name, like visualize_interactive
.
def visualize_bokeh( | |
def visualize_interactive( |
Kudos, SonarCloud Quality Gate passed! |
This PR adds "bokeh" as an alternative backend for the visualization utility.
The advantage of bokeh over matplotlib is that it allows for interactive plots in jupyter notebooks. Tooltips can then provide more detail on each interval.
This PR adds a basic implementation of the visualization. More additions are planned, but would take too much time/attention at the moment (see AI4S2S/lilio#6 ).
If multiple anchor years are to be displayed, the plot looks like the following:

With the

relative_dates
kwarg, the calendar can either be aligned to the anchors or show absolute dates of the intervals: