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

Skip to content

Commit 34daf13

Browse files
committed
removed lingering cm detritus
svn path=/trunk/matplotlib/; revision=1684
1 parent 2035193 commit 34daf13

3 files changed

Lines changed: 14 additions & 66 deletions

File tree

examples/two_scales.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
s2 = sin(2*pi*t)
3535
plot(t, s2, 'r.')
3636
ylabel('sin')
37-
37+
ax2.yaxis.tick_right()
3838
show()

lib/matplotlib/cm.py

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -369,66 +369,7 @@
369369
'summer': _summer_data,
370370
'winter': _winter_data
371371
}
372-
atad['Blues']=_Blues_data
373-
datad['BrBG']=_BrBG_data
374-
datad['BrBu']=_BrBu_data
375-
datad['Bu']=_Bu_data
376-
datad['BuDOr']=_BuDOr_data
377-
datad['BuDRd']=_BuDRd_data
378-
datad['BuGn']=_BuGn_data
379-
datad['BuGr']=_BuGr_data
380-
datad['BuGy']=_BuGy_data
381-
datad['BuOr']=_BuOr_data
382-
datad['BuOrR']=_BuOrR_data
383-
datad['BuPu']=_BuPu_data
384-
datad['Cat']=_Cat_data
385-
datad['Dark2']=_Dark2_data
386-
datad['GMT_gebco']=_GMT_gebco_data
387-
datad['GMT_globe']=_GMT_globe_data
388-
datad['GMT_haxby']=_GMT_haxby_data
389-
datad['GMT_no_green']=_GMT_no_green_data
390-
datad['GMT_ocean']=_GMT_ocean_data
391-
datad['GMT_polar']=_GMT_polar_data
392-
datad['GMT_red2green']=_GMT_red2green_data
393-
datad['GMT_relief']=_GMT_relief_data
394-
datad['GMT_seis']=_GMT_seis_data
395-
datad['GMT_wysiwyg']=_GMT_wysiwyg_data
396-
datad['GnBu']=_GnBu_data
397-
datad['Greens']=_Greens_data
398-
datad['Greys']=_Greys_data
399-
datad['GrMg']=_GrMg_data
400-
datad['Oranges']=_Oranges_data
401-
datad['OrRd']=_OrRd_data
402-
datad['Paired']=_Paired_data
403-
datad['Pastel1']=_Pastel1_data
404-
datad['Pastel2']=_Pastel2_data
405-
datad['PiYG']=_PiYG_data
406-
datad['PRGn']=_PRGn_data
407-
datad['PuBu']=_PuBu_data
408-
datad['PuBuGn']=_PuBuGn_data
409-
datad['PuOr']=_PuOr_data
410-
datad['PuRd']=_PuRd_data
411-
datad['Purples']=_Purples_data
412-
datad['RdBu']=_RdBu_data
413-
datad['RdGy']=_RdGy_data
414-
datad['RdPu']=_RdPu_data
415-
datad['RdYlBu']=_RdYlBu_data
416-
datad['RdYlGn']=_RdYlGn_data
417-
datad['Reds']=_Reds_data
418-
datad['Set1']=_Set1_data
419-
datad['Set2']=_Set2_data
420-
datad['Set3']=_Set3_data
421-
datad['Spectral']=_Spectral_data
422-
datad['StepSeq']=_StepSeq_data
423-
datad['StepSeqRev']=_StepSeqRev_data
424-
datad['YlGn']=_YlGn_data
425-
datad['YlGnBu']=_YlGnBu_data
426-
datad['YlOrBr']=_YlOrBr_data
427-
datad['YlOrRd']=_YlOrRd_data
428-
datad['GMT_rainbow']=_GMT_rainbow_data
429-
datad['GMT_sealand']=_GMT_sealand_data
430-
datad['GMT_topo']=_GMT_topo_data
431-
h
372+
432373
def get_cmap(name=None, lut=None):
433374
"""
434375
Get a colormap instance, defaulting to rc values if name is None

lib/matplotlib/legend.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,26 @@ def __init__(self, parent, handles, labels, loc,
169169

170170
# make a trial box in the middle of the axes. relocate it
171171
# based on it's bbox
172-
left, upper = 0.5, 0.5
172+
left, top = 0.5, 0.5
173173
if self.numpoints == 1:
174174
self._xdata = array([left + self.handlelen*0.5])
175175
else:
176176
self._xdata = linspace(left, left + self.handlelen, self.numpoints)
177177
textleft = left+ self.handlelen+self.handletextsep
178-
self.texts = self._get_texts(labels, textleft, upper)
178+
self.texts = self._get_texts(labels, textleft, top)
179179
self.legendHandles = self._get_handles(handles, self.texts)
180180

181-
left, top = self.texts[-1].get_position()
182-
HEIGHT = self._approx_text_height()
181+
182+
if len(self.texts):
183+
left, top = self.texts[-1].get_position()
184+
HEIGHT = self._approx_text_height()*len(self.texts)
185+
else:
186+
HEIGHT = 0.2
187+
183188
bottom = top-HEIGHT
184189
left -= self.handlelen + self.handletextsep + self.pad
185190
self.legendPatch = Rectangle(
186-
xy=(left, bottom), width=0.5, height=HEIGHT*len(self.texts),
191+
xy=(left, bottom), width=0.5, height=HEIGHT,
187192
facecolor='w', edgecolor='k',
188193
)
189194
self._set_artist_props(self.legendPatch)
@@ -208,6 +213,7 @@ def draw(self, renderer):
208213
self.legendPatch.draw(renderer)
209214

210215

216+
if not len(self.legendHandles) and not len(self.texts): return
211217
for h in self.legendHandles:
212218
if h is not None:
213219
h.draw(renderer)
@@ -497,6 +503,7 @@ def _update_positions(self, renderer):
497503
# called from renderer to allow more precise estimates of
498504
# widths and heights with get_window_extent
499505

506+
if not len(self.legendHandles) and not len(self.texts): return
500507
def get_tbounds(text): #get text bounds in axes coords
501508
bbox = text.get_window_extent(renderer)
502509
bboxa = inverse_transform_bbox(self._transform, bbox)

0 commit comments

Comments
 (0)