Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55a7a68

Browse files
committed
commented outline code, changed gridspace to show sqaure colorbar
1 parent a9aace3 commit 55a7a68

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

lib/matplotlib/colorbar.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,12 +1020,12 @@ def set_ticks(self, xticks, yticks, update_ticks=True):
10201020
10211021
"""
10221022
if cbook.iterable(xticks):
1023-
self.xlocator = ticker.FixedLocator(xticks, nbins=len(ticks))
1023+
self.xlocator = ticker.FixedLocator(xticks, nbins=len(xticks))
10241024
else:
10251025
self.xlocator = xticks
10261026

10271027
if cbook.iterable(yticks):
1028-
self.ylocator = ticker.FixedLocator(yticks, nbins=len(ticks))
1028+
self.ylocator = ticker.FixedLocator(yticks, nbins=len(yticks))
10291029
else:
10301030
self.ylocator = yticks
10311031

@@ -1037,14 +1037,15 @@ def get_ticks(self, minor=False):
10371037
"""Return the x ticks as a list of locations"""
10381038
return self._tick_data_values
10391039

1040-
def set_ticklabels(self, ticklabels, update_ticks=True):
1040+
def set_ticklabels(self, xticklabels, yticklabels, update_ticks=True):
10411041
"""
10421042
set tick labels. Tick labels are updated immediately unless
10431043
update_ticks is *False*. To manually update the ticks, call
10441044
*update_ticks* method explicitly.
10451045
"""
10461046
if isinstance(self.locator, ticker.FixedLocator):
1047-
self.formatter = ticker.FixedFormatter(ticklabels)
1047+
self.xformatter = ticker.FixedFormatter(xticklabels)
1048+
self.yformatter = ticker.FixedFormatter(yticklabels)
10481049
if update_ticks:
10491050
self.update_ticks()
10501051
else:
@@ -1056,14 +1057,15 @@ def _config_axes(self, X, Y):
10561057
Make an axes patch and outline.
10571058
'''
10581059
ax = self.ax
1059-
ax.set_frame_on(False)
1060+
# ax.set_frame_on(False)
10601061
ax.set_navigate(False)
1061-
xy = self._outline(X, Y)
1062-
ax.update_datalim(xy)
1063-
ax.set_xlim(*ax.dataLim.intervalx)
1064-
ax.set_ylim(*ax.dataLim.intervaly)
1065-
if self.outline is not None:
1066-
self.outline.remove()
1062+
# xy = self._outline(X, Y)
1063+
# ax.update_datalim(xy)
1064+
# ax.set_xlim(*ax.dataLim.intervalx)
1065+
# ax.set_ylim(*ax.dataLim.intervaly)
1066+
# if self.outline is not None:
1067+
# self.outline.remove()
1068+
"""
10671069
self.outline = mpatches.Polygon(
10681070
xy, edgecolor=mpl.rcParams['axes.edgecolor'],
10691071
facecolor='none',
@@ -1073,6 +1075,7 @@ def _config_axes(self, X, Y):
10731075
ax.add_artist(self.outline)
10741076
self.outline.set_clip_box(None)
10751077
self.outline.set_clip_path(None)
1078+
10761079
c = mpl.rcParams['axes.facecolor']
10771080
if self.patch is not None:
10781081
self.patch.remove()
@@ -1081,7 +1084,7 @@ def _config_axes(self, X, Y):
10811084
linewidth=0.01,
10821085
zorder=-1)
10831086
ax.add_artist(self.patch)
1084-
1087+
"""
10851088
self.update_ticks()
10861089

10871090
def _set_label(self):
@@ -1768,9 +1771,9 @@ def make_axes_gridspec(parent, **kw):
17681771
orientation = kw.setdefault('orientation', 'vertical')
17691772
kw['ticklocation'] = 'auto'
17701773

1771-
fraction = kw.pop('fraction', 0.15)
1774+
fraction = kw.pop('fraction', 0.35)
17721775
shrink = kw.pop('shrink', 1.0)
1773-
aspect = kw.pop('aspect', 20)
1776+
aspect = kw.pop('aspect', 1)
17741777

17751778
x1 = 1.0 - fraction
17761779

0 commit comments

Comments
 (0)