Skip to content

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

Merged
merged 85 commits into from
Jul 4, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
e2abff6
removed colorbars from _handle_shared_axes when called by scatterplot…
javadnoorb Mar 22, 2018
0ea226f
removed colorbars from _handle_shared_axes when called by scatterplot…
javadnoorb Mar 22, 2018
80f949f
added a debug global variable
javadnoorb Mar 22, 2018
8f52eab
removed whitespaces
javadnoorb Mar 22, 2018
215fb89
Update _core.py
javadnoorb Mar 28, 2018
7c6efe2
Update _core.py
javadnoorb Mar 28, 2018
8c71f60
Update _tools.py
javadnoorb Mar 29, 2018
63b9ee6
included tests for scatterplot and hexbin plot to ensure colorbar doe…
javadnoorb Mar 29, 2018
f401672
Update test_frame.py
javadnoorb Mar 29, 2018
b821474
Update test_frame.py
javadnoorb Mar 29, 2018
52c1fa8
Update _tools.py
javadnoorb Mar 29, 2018
edf008d
fixing assert message
javadnoorb Mar 29, 2018
db6cf67
Update test_frame.py
javadnoorb Mar 29, 2018
186a09c
fixing style issues
javadnoorb Mar 29, 2018
e6980f3
DOC: Improve the docstrings of CategoricalIndex.map (#20286)
l736x Mar 22, 2018
cdc0240
DOC: update the DataFrame.to_hdf() docstirng (#20186)
shelvinskyi Mar 22, 2018
4848dea
DOC: enable docstring on DataFrame.columns/index (#20385)
jorisvandenbossche Mar 22, 2018
5aed4b5
DOC: general docstring formatting fixes (#20449)
jorisvandenbossche Mar 22, 2018
e2053c9
parameterize tests in scalar/timedelta (#20428)
minggli Mar 22, 2018
268fcf6
API & BUG: allow list-like y argument to df.plot & fix integer arg to…
masongallo Mar 22, 2018
3a76199
Removed dead groupby code (#20457)
WillAyd Mar 22, 2018
189dd8e
EHN: allow zip compression in `to_pickle`, `to_json`, `to_csv` (#20394)
minggli Mar 22, 2018
c302b04
ENH: Sorting of ExtensionArrays (#19957)
TomAugspurger Mar 22, 2018
faefc89
DOC: Improve the docstring of DataFrame.transpose() (#20254)
igorcadelima Mar 23, 2018
4a77c96
DOC: Update pandas.Series.copy docstring (#20261)
thismakessand Mar 23, 2018
e03b4b8
DOC: update the pandas.DataFrame.plot.box docstring (#20373)
4kxz Mar 23, 2018
5ffb078
DOC: make deprecation warning more visible with red box (#20357)
Imanflow Mar 23, 2018
689b3fe
TST: clean deprecation warnings & some parametrizing (#20467)
jreback Mar 23, 2018
7f97c13
REF: Mock all S3 Tests (#20409)
TomAugspurger Mar 23, 2018
9dd5111
TST: Fixed version comparison (#20469)
TomAugspurger Mar 24, 2018
10db32e
TST: 32-bit compat for categorical factorization tests (#20482)
jreback Mar 25, 2018
c1cbd96
API: Preserve int columns in to_dict('index') (#20444)
reidy-p Mar 25, 2018
cfad93f
DOC: Fix broken dependency links (#20471)
tv3141 Mar 25, 2018
f3eaa55
DOC: update the pandas.Series.str.startswith docstring (#20458)
dcreekp Mar 25, 2018
daa3b33
BUG: dropna() on single column timezone-aware values (#13407) (#20422)
JQGoh Mar 25, 2018
40a91c5
TST: test_nanops some parametrize & catch warnings (RuntimeWarning: A…
jreback Mar 26, 2018
eecb129
ENH: DataFrame.pivot accepts a list of values (#18636)
ibrahimsharaf Mar 26, 2018
31f7dc2
BUG: raise error when setting cached properties (#20487)
jorisvandenbossche Mar 26, 2018
56ca9a3
DOC: update the DataFrame.stack docstring (#20430)
samuelsinayoko Mar 26, 2018
492130b
CI: Fixed deprecationWarning (#20489)
TomAugspurger Mar 26, 2018
f02b82b
DOC: update the isna, isnull, notna and notnull docstring (#20459)
Cheukting Mar 26, 2018
9778c85
CLN: remove deprecated infer_dst keyword (#20490)
jorisvandenbossche Mar 27, 2018
a346778
Parametrized NA sentinel for factorize (#20473)
TomAugspurger Mar 27, 2018
b4365e8
DEPR: deprecate get_ftype_counts (GH18243) (#20404)
GGordonGordon Mar 27, 2018
15b7138
DOC: update the Series.str.join docstring (#20463)
fdroessler Mar 27, 2018
b0143e5
ENH/API: ExtensionArray.factorize (#20361)
TomAugspurger Mar 27, 2018
e6c2945
DOC: update vendored numpydoc version
jorisvandenbossche Mar 16, 2018
d2e23f8
DOC: change to numpydoc: add option to use member listing for attributes
jorisvandenbossche Mar 16, 2018
91e5e6b
DOC: change to numpydoc: use isdatadescriptor instead of isgetsetdesc…
jorisvandenbossche Mar 27, 2018
4c6688d
DOC: use numpydoc_use_blockquotes=False for compatibility
jorisvandenbossche Mar 16, 2018
3e91555
DOC: docstring to series.unique (#20474)
minggli Mar 23, 2018
71dff0d
DOC: add guide on shared docstrings (#20016)
TomAugspurger Mar 28, 2018
72524e8
Set pd.options.display.max_columns=0 by default (#17023)
cbrnr Mar 28, 2018
fd08b9f
DOC: whatsnew edits
jreback Mar 28, 2018
3549eca
ENH: Support ExtensionArray in Groupby (#20502)
TomAugspurger Mar 28, 2018
223ae0a
DOC: update the pandas.Series.str.endswith docstring (#20491)
dcreekp Mar 28, 2018
f067b47
DOC: Improving the docstring of Series.str.upper and related (#20462)
Hamishpk Mar 28, 2018
aa1dbd2
DOC: update the Series.between docstring (#20443)
mrw34 Mar 28, 2018
86f17cb
CLN: Removed not necessary bn switch decorator on nansum (#20481)
Mar 29, 2018
3d47aec
DOC: Fix various warnings (#20509)
TomAugspurger Mar 29, 2018
0c3c723
DOC: whatsnew edits
jreback Mar 29, 2018
145d75c
DOC: Add comparison with Stata page to documentation (#19945)
kylebarron Mar 29, 2018
64a2a55
DOC: Update missing_data.rst (#20424)
pulkitmaloo Mar 29, 2018
41cdfdc
Update v0.23.0.txt
javadnoorb Mar 29, 2018
c8ff378
Merge branch 'master' into master
javadnoorb Mar 29, 2018
48291ef
Update test_frame.py
javadnoorb Mar 29, 2018
09c7636
remove whitespace
javadnoorb Mar 30, 2018
864420b
Inline backend (#2)
javadnoorb Apr 10, 2018
eb123be
Update _tools.py
javadnoorb Apr 10, 2018
1fb4eec
Update _core.py
javadnoorb Apr 10, 2018
0397999
Update _core.py
javadnoorb Apr 10, 2018
5ba105f
Update v0.23.0.txt
javadnoorb Apr 10, 2018
ad1b495
Update _core.py
javadnoorb Apr 10, 2018
bdc7f5a
Inline backend - fixing colorbar axis position roundoff error locally
javadnoorb Apr 13, 2018
e656f6e
broken merge
javadnoorb Apr 13, 2018
1e4efd3
Merge remote-tracking branch 'upstream/master'
javadnoorb Apr 23, 2018
45aea6f
Merge remote-tracking branch 'upstream/master'
javadnoorb Apr 24, 2018
eeb6a9f
update fork
javadnoorb Jun 30, 2018
a802ecf
refactoring
javadnoorb Jun 30, 2018
8d766ae
refactoring
javadnoorb Jun 30, 2018
4f380b2
updating whatsnew docs
javadnoorb Jun 30, 2018
04ff768
updating whatsnew docs
javadnoorb Jun 30, 2018
8c0f2e5
updating whatsnew docs
javadnoorb Jun 30, 2018
564790f
updating whatsnew docs
javadnoorb Jun 30, 2018
7196d6e
added more comments
javadnoorb Jul 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pandas/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

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.

img = ax.collections[0]
kws = dict(ax=ax)
if self.mpl_ge_1_3_1():
Expand Down Expand Up @@ -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)
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment.

img = ax.collections[0]
self.fig.colorbar(img, ax=ax)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pandas/plotting/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:
Expand Down