@@ -182,8 +182,9 @@ def _doPlot(self):
182
182
myCols = numPlots
183
183
myPos = (currentRow * numPlots ) + currentColumn
184
184
185
- (currPlotHandles , currPlotLabels ) = plot .subplot (
186
- fig , myRows , myCols , myPos , projection = plot .projection )
185
+ (currPlotHandles , currPlotLabels ) = self ._plot_subplot (
186
+ plot = plot , fig = fig , rows = myRows , cols = myCols ,
187
+ pos = myPos , projection = plot .projection )
187
188
188
189
for i in xrange (len (currPlotHandles )):
189
190
if currPlotLabels [i ] in plotLabels :
@@ -196,9 +197,6 @@ def _doPlot(self):
196
197
197
198
plotLabels .append (currPlotLabels [i ])
198
199
199
- # plotHandles.extend(currPlotHandles)
200
- # plotLabels.extend(currPlotLabels)
201
-
202
200
currentColumn += 1
203
201
currentRow += 1
204
202
@@ -214,8 +212,10 @@ def _doPlot(self):
214
212
myCols = numColumns
215
213
myPos = (currentRow * numColumns ) + currentColumn
216
214
217
- (currPlotHandles , currPlotLabels ) = plot .subplot (
218
- fig , myRows , myCols , myPos , projection = plot .projection )
215
+ (currPlotHandles , currPlotLabels ) = self ._plot_subplot (
216
+ plot = plot , fig = fig , rows = myRows , cols = myCols ,
217
+ pos = myPos , projection = plot .projection )
218
+
219
219
for i in xrange (len (currPlotHandles )):
220
220
if currPlotLabels [i ] in plotLabels :
221
221
continue
@@ -239,11 +239,7 @@ def _doPlot(self):
239
239
figLegendKeywords = {}
240
240
241
241
if self .figLegendCols is not None :
242
- versionPieces = [int (x ) for x in matplotlib .__version__ .split ('.' )]
243
-
244
- (superMajor , major , minor ) = versionPieces [0 :3 ]
245
-
246
- if superMajor == 0 and major < 98 :
242
+ if not self ._check_min_matplotlib_version ((0 , 98 , 0 )):
247
243
warnings .warn ("Number of columns support not available in "
248
244
"versions of matplotlib prior to 0.98" )
249
245
else :
@@ -266,6 +262,18 @@ def _doPlot(self):
266
262
267
263
return fig
268
264
265
+ def _plot_subplot (self , plot , fig , rows , cols , pos , projection ):
266
+ return plot .subplot (fig , rows , cols , pos , projection )
267
+
268
+ def _check_min_matplotlib_version (self , version ):
269
+ versionPieces = [int (x ) for x in matplotlib .__version__ .split ('.' )]
270
+
271
+ (superMajor , major , minor ) = versionPieces [0 :3 ]
272
+
273
+ minVersionSatisfied = (superMajor >= version [0 ] and major >= version [1 ]
274
+ and minor >= version [2 ])
275
+ return minVersionSatisfied
276
+
269
277
def plot (self ):
270
278
fig = self ._doPlot ()
271
279
if not pylab .isinteractive ():
0 commit comments