-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix Scatter plot datetime and Axis #12949
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c81e500
Attempted fixes for #8113 and #10678
nparley b7036bb
Create a new method which can override _compute_plot_data if the plot…
nparley 8b8d542
Move _compute_plot_data_with_dt to PlanePlot class
nparley 8c0ffe2
Fix lint error.
nparley 13de504
Addressed comments
nparley cbf3c73
Reduce line length
nparley 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 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1579,8 +1579,11 @@ class PlanePlot(MPLPlot): | |
|
||
_layout_type = 'single' | ||
|
||
def __init__(self, data, x, y, **kwargs): | ||
MPLPlot.__init__(self, data, **kwargs) | ||
def __init__(self, data, x, y, sharex=False, **kwargs): | ||
if sharex is None: | ||
# Fix x axis color bar problems | ||
sharex = False | ||
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. This sharex fix, is this independent from the datetime fix? |
||
MPLPlot.__init__(self, data, sharex=sharex, **kwargs) | ||
if x is None or y is None: | ||
raise ValueError(self._kind + ' requires and x and y column') | ||
if is_integer(x) and not self.data.columns.holds_integer(): | ||
|
@@ -1613,6 +1616,31 @@ def __init__(self, data, x, y, s=None, c=None, **kwargs): | |
c = self.data.columns[c] | ||
self.c = c | ||
|
||
def _compute_plot_data(self): | ||
data = self.data | ||
|
||
if isinstance(data, Series): | ||
label = self.label | ||
if label is None and data.name is None: | ||
label = 'None' | ||
data = data.to_frame(name=label) | ||
|
||
numeric_dt__data = data._convert(datetime=True)._get_numeric_data() | ||
time_data = data._convert(datetime=True)._get_datetime_data() | ||
numeric_dt__data = numeric_dt__data.join(time_data) | ||
|
||
try: | ||
is_empty = numeric_dt__data.empty | ||
except AttributeError: | ||
is_empty = not len(numeric_dt__data) | ||
|
||
# no empty frames or series allowed | ||
if is_empty: | ||
raise TypeError('Empty {0!r}: no numeric data to ' | ||
'plot'.format(numeric_dt__data.__class__.__name__)) | ||
|
||
self.data = numeric_dt__data | ||
|
||
def _make_plot(self): | ||
x, y, c, data = self.x, self.y, self.c, self.data | ||
ax = self.axes[0] | ||
|
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.
To apply the same fix to hexbin, pls move the logic to
PlanePlot
. And I thinksharex
should be alwaysFalse
because we don't support scatter subplots ATM?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.
@sinhrks This is in
PlanePlot