File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1196,13 +1196,14 @@ class LogLocator(Locator):
11961196 Determine the tick locations for log axes
11971197 """
11981198
1199- def __init__ (self , base = 10.0 , subs = [1.0 ]):
1199+ def __init__ (self , base = 10.0 , subs = [1.0 ], numdecs = 4 ):
12001200 """
12011201 place ticks on the location= base**i*subs[j]
12021202 """
12031203 self .base (base )
12041204 self .subs (subs )
12051205 self .numticks = 15
1206+ self .numdecs = numdecs
12061207
12071208 def base (self ,base ):
12081209 """
@@ -1227,6 +1228,14 @@ def __call__(self):
12271228 b = self ._base
12281229
12291230 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+
12301239 if vmin <= 0.0 :
12311240 vmin = self .axis .get_minpos ()
12321241 if vmin <= 0.0 :
@@ -1265,10 +1274,16 @@ def __call__(self):
12651274
12661275 def view_limits (self , vmin , vmax ):
12671276 'Try to choose the view limits intelligently'
1277+ b = self ._base
12681278
12691279 if vmax < vmin :
12701280 vmin , vmax = vmax , vmin
12711281
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+
12721287 minpos = self .axis .get_minpos ()
12731288
12741289 if minpos <= 0 :
You can’t perform that action at this time.
0 commit comments