@@ -2217,10 +2217,10 @@ def readshapefile(self,shapefile,name,drawbounds=True,zorder=None,
2217
2217
self .__dict__ [name + '_info' ]= attributes
2218
2218
return info
2219
2219
2220
- def drawparallels (self ,circles ,color = 'k' ,linewidth = 1. ,zorder = None , \
2220
+ def drawparallels (self ,circles ,color = 'k' ,textcolor = 'k' , linewidth = 1. ,zorder = None , \
2221
2221
dashes = [1 ,1 ],labels = [0 ,0 ,0 ,0 ],labelstyle = None , \
2222
2222
fmt = '%g' ,xoffset = None ,yoffset = None ,ax = None ,latmax = None ,
2223
- ** kwargs ):
2223
+ ** text_kwargs ):
2224
2224
"""
2225
2225
Draw and label parallels (latitude lines) for values (in degrees)
2226
2226
given in the sequence ``circles``.
@@ -2231,6 +2231,7 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
2231
2231
Keyword Description
2232
2232
============== ====================================================
2233
2233
color color to draw parallels (default black).
2234
+ textcolor color to draw labels (default black).
2234
2235
linewidth line width for parallels (default 1.)
2235
2236
zorder sets the zorder for parallels (if not specified,
2236
2237
uses default zorder for matplotlib.lines.Line2D
@@ -2259,7 +2260,7 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
2259
2260
ax axes instance (overrides default axes instance)
2260
2261
latmax absolute value of latitude to which meridians are drawn
2261
2262
(default is 80).
2262
- \**kwargs additional keyword arguments controlling text
2263
+ \**text_kwargs additional keyword arguments controlling text
2263
2264
for labels that are passed on to
2264
2265
the text method of the axes instance (see
2265
2266
matplotlib.pyplot.text documentation).
@@ -2271,6 +2272,7 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
2271
2272
associated with each parallel. Deleting an item from the
2272
2273
dictionary removes the corresponding parallel from the plot.
2273
2274
"""
2275
+ text_kwargs ['color' ]= textcolor # pass textcolor kwarg on to ax.text
2274
2276
# if celestial=True, don't use "N" and "S" labels.
2275
2277
if labelstyle is None and self .celestial :
2276
2278
labelstyle = "+/-"
@@ -2446,13 +2448,13 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
2446
2448
xlab = xlab - xoffset
2447
2449
if self .projection in _pseudocyl :
2448
2450
if lat > 0 :
2449
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'bottom' ,** kwargs )
2451
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'bottom' ,** text_kwargs )
2450
2452
elif lat < 0 :
2451
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'top' ,** kwargs )
2453
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'top' ,** text_kwargs )
2452
2454
else :
2453
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'center' ,** kwargs )
2455
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'center' ,** text_kwargs )
2454
2456
else :
2455
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'center' ,** kwargs )
2457
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'right' ,verticalalignment = 'center' ,** text_kwargs )
2456
2458
elif side == 'r' :
2457
2459
if self .projection in _pseudocyl :
2458
2460
if self .celestial :
@@ -2464,17 +2466,17 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
2464
2466
xlab = xlab + xoffset
2465
2467
if self .projection in _pseudocyl :
2466
2468
if lat > 0 :
2467
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'bottom' ,** kwargs )
2469
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'bottom' ,** text_kwargs )
2468
2470
elif lat < 0 :
2469
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'top' ,** kwargs )
2471
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'top' ,** text_kwargs )
2470
2472
else :
2471
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'center' ,** kwargs )
2473
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'center' ,** text_kwargs )
2472
2474
else :
2473
- t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'center' ,** kwargs )
2475
+ t = ax .text (xlab ,yy [n ],latlab ,horizontalalignment = 'left' ,verticalalignment = 'center' ,** text_kwargs )
2474
2476
elif side == 'b' :
2475
- t = ax .text (xx [n ],self .llcrnry - yoffset ,latlab ,horizontalalignment = 'center' ,verticalalignment = 'top' ,** kwargs )
2477
+ t = ax .text (xx [n ],self .llcrnry - yoffset ,latlab ,horizontalalignment = 'center' ,verticalalignment = 'top' ,** text_kwargs )
2476
2478
else :
2477
- t = ax .text (xx [n ],self .urcrnry + yoffset ,latlab ,horizontalalignment = 'center' ,verticalalignment = 'bottom' ,** kwargs )
2479
+ t = ax .text (xx [n ],self .urcrnry + yoffset ,latlab ,horizontalalignment = 'center' ,verticalalignment = 'bottom' ,** text_kwargs )
2478
2480
if t is not None : linecolls [lat ][1 ].append (t )
2479
2481
2480
2482
# set axes limits to fit map region.
@@ -2501,10 +2503,10 @@ def drawparallels(self,circles,color='k',linewidth=1.,zorder=None, \
2501
2503
l .set_clip_path (c )
2502
2504
return pardict
2503
2505
2504
- def drawmeridians (self ,meridians ,color = 'k' ,linewidth = 1. , zorder = None ,\
2506
+ def drawmeridians (self ,meridians ,color = 'k' ,textcolor = 'k' , linewidth = 1. , zorder = None ,\
2505
2507
dashes = [1 ,1 ],labels = [0 ,0 ,0 ,0 ],labelstyle = None ,\
2506
2508
fmt = '%g' ,xoffset = None ,yoffset = None ,ax = None ,latmax = None ,
2507
- ** kwargs ):
2509
+ ** text_kwargs ):
2508
2510
"""
2509
2511
Draw and label meridians (longitude lines) for values (in degrees)
2510
2512
given in the sequence ``meridians``.
@@ -2515,6 +2517,7 @@ def drawmeridians(self,meridians,color='k',linewidth=1., zorder=None,\
2515
2517
Keyword Description
2516
2518
============== ====================================================
2517
2519
color color to draw meridians (default black).
2520
+ textcolor color to draw labels (default black).
2518
2521
linewidth line width for meridians (default 1.)
2519
2522
zorder sets the zorder for meridians (if not specified,
2520
2523
uses default zorder for matplotlib.lines.Line2D
@@ -2543,7 +2546,7 @@ def drawmeridians(self,meridians,color='k',linewidth=1., zorder=None,\
2543
2546
ax axes instance (overrides default axes instance)
2544
2547
latmax absolute value of latitude to which meridians are drawn
2545
2548
(default is 80).
2546
- \**kwargs additional keyword arguments controlling text
2549
+ \**text_kwargs additional keyword arguments controlling text
2547
2550
for labels that are passed on to
2548
2551
the text method of the axes instance (see
2549
2552
matplotlib.pyplot.text documentation).
@@ -2555,6 +2558,7 @@ def drawmeridians(self,meridians,color='k',linewidth=1., zorder=None,\
2555
2558
associated with each meridian. Deleting an item from the
2556
2559
dictionary removes the correpsonding meridian from the plot.
2557
2560
"""
2561
+ text_kwargs ['color' ]= textcolor # pass textcolor kwarg on to ax.text
2558
2562
# for cylindrical projections, try to handle wraparound (i.e. if
2559
2563
# projection is defined in -180 to 0 and user asks for meridians from
2560
2564
# 180 to 360 to be drawn, it should work)
@@ -2718,13 +2722,13 @@ def addlon(meridians,madd):
2718
2722
if n >= 0 :
2719
2723
t = None
2720
2724
if side == 'l' :
2721
- t = ax .text (self .llcrnrx - xoffset ,yy [n ],lonlab ,horizontalalignment = 'right' ,verticalalignment = 'center' ,** kwargs )
2725
+ t = ax .text (self .llcrnrx - xoffset ,yy [n ],lonlab ,horizontalalignment = 'right' ,verticalalignment = 'center' ,** text_kwargs )
2722
2726
elif side == 'r' :
2723
- t = ax .text (self .urcrnrx + xoffset ,yy [n ],lonlab ,horizontalalignment = 'left' ,verticalalignment = 'center' ,** kwargs )
2727
+ t = ax .text (self .urcrnrx + xoffset ,yy [n ],lonlab ,horizontalalignment = 'left' ,verticalalignment = 'center' ,** text_kwargs )
2724
2728
elif side == 'b' :
2725
- t = ax .text (xx [n ],self .llcrnry - yoffset ,lonlab ,horizontalalignment = 'center' ,verticalalignment = 'top' ,** kwargs )
2729
+ t = ax .text (xx [n ],self .llcrnry - yoffset ,lonlab ,horizontalalignment = 'center' ,verticalalignment = 'top' ,** text_kwargs )
2726
2730
else :
2727
- t = ax .text (xx [n ],self .urcrnry + yoffset ,lonlab ,horizontalalignment = 'center' ,verticalalignment = 'bottom' ,** kwargs )
2731
+ t = ax .text (xx [n ],self .urcrnry + yoffset ,lonlab ,horizontalalignment = 'center' ,verticalalignment = 'bottom' ,** text_kwargs )
2728
2732
2729
2733
if t is not None : linecolls [lon ][1 ].append (t )
2730
2734
# set axes limits to fit map region.
@@ -2813,8 +2817,7 @@ def addlon(meridians,madd):
2813
2817
if labels [1 ] and not labels [0 ] and x >= 0.5 * (self .xmin + self .xmax )- xoffset : continue
2814
2818
if labels [2 ] and not labels [3 ] and y >= 0.5 * (self .ymin + self .ymax )- yoffset : continue
2815
2819
if labels [3 ] and not labels [2 ] and y <= 0.5 * (self .ymin + self .ymax )+ yoffset : continue
2816
- t = \
2817
- ax .text (x ,y ,lonlab ,horizontalalignment = horizalign ,verticalalignment = vertalign ,** kwargs )
2820
+ t = ax .text (x ,y ,lonlab ,horizontalalignment = horizalign ,verticalalignment = vertalign ,** text_kwargs )
2818
2821
meridict [merid ][1 ].append (t )
2819
2822
return meridict
2820
2823
0 commit comments