-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
scatter plot and hexbin plot lose x-axis when colorbar is included. #20446
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
Changes from 6 commits
e2abff6
0ea226f
80f949f
8f52eab
215fb89
7c6efe2
8c71f60
63b9ee6
f401672
b821474
52c1fa8
edf008d
db6cf67
186a09c
e6980f3
cdc0240
4848dea
5aed4b5
e2053c9
268fcf6
3a76199
189dd8e
c302b04
faefc89
4a77c96
e03b4b8
5ffb078
689b3fe
7f97c13
9dd5111
10db32e
c1cbd96
cfad93f
f3eaa55
daa3b33
40a91c5
eecb129
31f7dc2
56ca9a3
492130b
f02b82b
9778c85
a346778
b4365e8
15b7138
b0143e5
e6c2945
d2e23f8
91e5e6b
4c6688d
3e91555
71dff0d
72524e8
fd08b9f
3549eca
223ae0a
f067b47
aa1dbd2
86f17cb
3d47aec
0c3c723
145d75c
64a2a55
41cdfdc
c8ff378
48291ef
09c7636
864420b
eb123be
1fb4eec
0397999
5ba105f
ad1b495
bdc7f5a
e656f6e
1e4efd3
45aea6f
eeb6a9f
a802ecf
8d766ae
4f380b2
04ff768
8c0f2e5
564790f
7196d6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -870,6 +870,7 @@ def _make_plot(self): | |
scatter = ax.scatter(data[x].values, data[y].values, c=c_values, | ||
label=label, cmap=cmap, **self.kwds) | ||
if cb: | ||
ax._pandas_colorbar_axes = True | ||
img = ax.collections[0] | ||
kws = dict(ax=ax) | ||
if self.mpl_ge_1_3_1(): | ||
|
@@ -902,6 +903,7 @@ def __init__(self, data, x, y, C=None, **kwargs): | |
def _make_plot(self): | ||
x, y, data, C = self.x, self.y, self.data, self.C | ||
ax = self.axes[0] | ||
|
||
# pandas uses colormap, matplotlib uses cmap. | ||
cmap = self.colormap or 'BuGn' | ||
cmap = self.plt.cm.get_cmap(cmap) | ||
|
@@ -915,6 +917,7 @@ def _make_plot(self): | |
ax.hexbin(data[x].values, data[y].values, C=c_values, cmap=cmap, | ||
**self.kwds) | ||
if cb: | ||
ax._pandas_colorbar_axes = True | ||
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. Comment. |
||
img = ax.collections[0] | ||
self.fig.colorbar(img, ax=ax) | ||
|
||
|
@@ -2790,6 +2793,7 @@ def __call__(self, x=None, y=None, kind='line', ax=None, | |
rot=None, fontsize=None, colormap=None, table=False, | ||
yerr=None, xerr=None, | ||
secondary_y=False, sort_columns=False, **kwds): | ||
|
||
return plot_frame(self._data, kind=kind, x=x, y=y, ax=ax, | ||
subplots=subplots, sharex=sharex, sharey=sharey, | ||
layout=layout, figsize=figsize, use_index=use_index, | ||
|
@@ -3286,6 +3290,7 @@ def scatter(self, x, y, s=None, c=None, **kwds): | |
... c='species', | ||
... colormap='viridis') | ||
""" | ||
|
||
return self(kind='scatter', x=x, y=y, c=c, s=s, **kwds) | ||
|
||
def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None, | ||
|
@@ -3371,6 +3376,7 @@ def hexbin(self, x, y, C=None, reduce_C_function=None, gridsize=None, | |
... gridsize=10, | ||
... cmap="viridis") | ||
""" | ||
|
||
if reduce_C_function is not None: | ||
kwds['reduce_C_function'] = reduce_C_function | ||
if gridsize is not None: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,7 +311,7 @@ def _handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey): | |
# only the last row of subplots should get x labels -> all | ||
# other off layout handles the case that the subplot is | ||
# the last in the column, because below is no subplot/gap. | ||
if not layout[ax.rowNum + 1, ax.colNum]: | ||
if not layout[ax.rowNum + 1, ax.colNum] or getattr(ax, '_pandas_colorbar_axes', 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 line is too long: https://travis-ci.org/pandas-dev/pandas/jobs/359516939#L3006 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. Thanks. I'll fix it. Sorry I'm pretty new to the open-source world. |
||
continue | ||
if sharex or len(ax.get_shared_x_axes() | ||
.get_siblings(ax)) > 1: | ||
|
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.
Add a comment here explaining why you're adding this attribute.