File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1196,13 +1196,14 @@ class LogLocator(Locator):
1196
1196
Determine the tick locations for log axes
1197
1197
"""
1198
1198
1199
- def __init__ (self , base = 10.0 , subs = [1.0 ]):
1199
+ def __init__ (self , base = 10.0 , subs = [1.0 ], numdecs = 4 ):
1200
1200
"""
1201
1201
place ticks on the location= base**i*subs[j]
1202
1202
"""
1203
1203
self .base (base )
1204
1204
self .subs (subs )
1205
1205
self .numticks = 15
1206
+ self .numdecs = numdecs
1206
1207
1207
1208
def base (self ,base ):
1208
1209
"""
@@ -1227,6 +1228,14 @@ def __call__(self):
1227
1228
b = self ._base
1228
1229
1229
1230
vmin , vmax = self .axis .get_view_interval ()
1231
+
1232
+ if self .axis .axes .name == 'polar' :
1233
+ vmax = math .ceil (math .log (vmax ) / math .log (b ))
1234
+ decades = np .arange (vmax - self .numdecs , vmax )
1235
+ ticklocs = b ** decades
1236
+
1237
+ return ticklocs
1238
+
1230
1239
if vmin <= 0.0 :
1231
1240
vmin = self .axis .get_minpos ()
1232
1241
if vmin <= 0.0 :
@@ -1265,10 +1274,16 @@ def __call__(self):
1265
1274
1266
1275
def view_limits (self , vmin , vmax ):
1267
1276
'Try to choose the view limits intelligently'
1277
+ b = self ._base
1268
1278
1269
1279
if vmax < vmin :
1270
1280
vmin , vmax = vmax , vmin
1271
1281
1282
+ if self .axis .axes .name == 'polar' :
1283
+ vmax = math .ceil (math .log (vmax ) / math .log (b ))
1284
+ vmin = b ** (vmax - self .numdecs )
1285
+ return vmin , vmax
1286
+
1272
1287
minpos = self .axis .get_minpos ()
1273
1288
1274
1289
if minpos <= 0 :
You can’t perform that action at this time.
0 commit comments