-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fix x ranges upon projection #722
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a647173
fix plot disappearing
ahuang11 d150503
Add missign file
ahuang11 aa5f4aa
Simplify
ahuang11 f9dc789
stricter checks
ahuang11 635b26f
add tests
ahuang11 030bd2e
Update geoviews/plotting/bokeh/callbacks.py
ahuang11 d3058be
move to update_frame
ahuang11 9d7a892
Apply suggestions from code review
ahuang11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
""" | ||
import param | ||
|
||
from cartopy.crs import GOOGLE_MERCATOR, PlateCarree, Mercator | ||
from cartopy.crs import GOOGLE_MERCATOR, PlateCarree, Mercator, _CylindricalProjection | ||
from bokeh.models.tools import BoxZoomTool, WheelZoomTool | ||
from bokeh.models import MercatorTickFormatter, MercatorTicker, CustomJSHover | ||
from holoviews.core.dimension import Dimension | ||
|
@@ -70,6 +70,8 @@ def __init__(self, element, **params): | |
'and disable the show_grid option.' | ||
) | ||
|
||
self._unwrap_lons = False | ||
|
||
def _axis_properties(self, axis, key, plot, dimension=None, | ||
ax_mapping=None): | ||
if ax_mapping is None: | ||
|
@@ -103,6 +105,11 @@ def _update_ranges(self, element, ranges): | |
ax_range.end = mid + min_interval/2. | ||
ax_range.min_interval = min_interval | ||
|
||
def _set_unwrap_lons(self, element): | ||
if isinstance(self.geographic, _CylindricalProjection): | ||
x1, x2 = element.range(0) | ||
self._unwrap_lons = 0 <= x1 <= 360 and 0 <= x2 <= 360 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is too eager, specifically it should check that it's actually in the 0-360 range rather than merely all being east of Greenwich, so something like:
|
||
|
||
def initialize_plot(self, ranges=None, plot=None, plots=None, source=None): | ||
opts = {} if isinstance(self, HvOverlayPlot) else {'source': source} | ||
fig = super().initialize_plot(ranges, plot, plots, **opts) | ||
|
@@ -113,8 +120,14 @@ def initialize_plot(self, ranges=None, plot=None, plots=None, source=None): | |
overlaid=True, renderer=self.renderer) | ||
shapeplot.geographic = False | ||
shapeplot.initialize_plot(plot=fig) | ||
self._set_unwrap_lons(self.current_frame) | ||
return fig | ||
|
||
def update_frame(self, key, ranges=None, element=None): | ||
if element is not None: | ||
self._set_unwrap_lons(element) | ||
super().update_frame(key, ranges, element) | ||
|
||
def _postprocess_hover(self, renderer, source): | ||
super()._postprocess_hover(renderer, source) | ||
hover = self.handles["plot"].hover | ||
|
This file contains 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
Oops, something went wrong.
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.
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 should be: