10000 Shared axes colorbars & finer location control by pelson · Pull Request #956 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Shared axes colorbars & finer location control #956

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 5 commits into from
May 14, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Rebased and updated tests.
  • Loading branch information
pelson committed May 14, 2013
commit da8827164b5d7664e0efb1fee8995769f5cfe32d
18 changes: 6 additions & 12 deletions lib/matplotlib/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def __init__(self, ax, cmap=None,
filled=True,
extendfrac=None,
extendrect=False,
label='',
):
self.ax = ax
self._patch_ax()
Expand Down Expand Up @@ -352,7 +353,6 @@ def config_axis(self):
ax.yaxis.set_ticks([])
# location is either one of 'left' or 'right'
ax.xaxis.set_label_position(self.ticklocation)
# XXX This wasn't enabled before...
ax.xaxis.set_ticks_position(self.ticklocation)

self._set_label()
Expand Down Expand Up @@ -1228,11 +1228,8 @@ def _add_solids(self, X, Y, C):

patch = mpatches.PathPatch(mpath.Path(xy),
facecolor=self.cmap(self.norm(val)),
hatch=hatch,
edgecolor='none', linewidth=0,
antialiased=False, **kw
)

hatch=hatch, linewidth=0,
antialiased=False, **kw)
self.ax.add_patch(patch)
patches.append(patch)

Expand All @@ -1247,12 +1244,9 @@ def _add_solids(self, X, Y, C):
self.dividers = None

if self.drawedges:
self.dividers = collections.LineCollection(
self._edges(X, Y),
colors=(mpl.rcParams['axes.edgecolor'],),
linewidths=(
0.5 * mpl.rcParams['axes.linewidth'],)
)
self.dividers = collections.LineCollection(self._edges(X, Y),
colors=(mpl.rcParams['axes.edgecolor'],),
linewidths=(0.5 * mpl.rcParams['axes.linewidth'],))
self.ax.add_collection(self.dividers)

self.ax.hold(_hold)
Expand Down
7 changes: 5 additions & 2 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ def savefig(self, *args, **kwargs):
ax.patch.set_edgecolor(cc[1])

@docstring.dedent_interpd
def colorbar(self, mappable, cax=None, ax=None, use_gridspec=False, **kw):
def colorbar(self, mappable, cax=None, ax=None, use_gridspec=True, **kw):
"""
Create a colorbar for a ScalarMappable instance, *mappable*.

Expand All @@ -1428,6 +1428,9 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=False, **kw):
if ax is None:
ax = self.gca()

# Store the value of gca so that we can set it back later on.
current_ax = self.gca()

if cax is None:
if use_gridspec and isinstance(ax, SubplotBase):
cax, kw = cbar.make_axes_gridspec(ax, **kw)
Expand All @@ -1436,7 +1439,7 @@ def colorbar(self, mappable, cax=None, ax=None, use_gridspec=False, **kw):
cax.hold(True)
cb = cbar.colorbar_factory(cax, mappable, **kw)

self.sca(ax)
self.sca(current_ax)
return cb

def subplots_adjust(self, *args, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ def rc_context(rc=None, fname=None):
return matplotlib.rc_context(rc, fname)



@docstring.copy_dedent(matplotlib.rcdefaults)
def rcdefaults():
matplotlib.rcdefaults()
Expand Down Expand Up @@ -303,8 +302,8 @@ def xkcd():
raise
return context

## Figures ##

## Figures ##

def figure(num=None, # autoincrement if None, else integer from 1-N
figsize=None, # defaults to rc figure.figsize
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
0