@@ -5443,7 +5443,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
5443
5443
lines_kw ['transform' ] = kwargs ['transform' ]
5444
5444
if 'zorder' in kwargs :
5445
5445
lines_kw ['zorder' ] = kwargs ['zorder' ]
5446
-
5446
+
5447
5447
# arrays fine here, they are booleans and hence not units
5448
5448
if not iterable (lolims ):
5449
5449
lolims = np .asarray ([lolims ]* len (x ), bool )
@@ -6432,32 +6432,39 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
6432
6432
offsets = offsets [good_idxs ,:]
6433
6433
accum = accum [good_idxs ]
6434
6434
6435
- if xscale == 'log' :
6436
- offsets [:,0 ] = 10 ** (offsets [:,0 ])
6437
- xmin = 10 ** xmin
6438
- xmax = 10 ** xmax
6439
- self .set_xscale ('log' )
6440
- if yscale == 'log' :
6441
- offsets [:,1 ] = 10 ** (offsets [:,1 ])
6442
- ymin = 10 ** ymin
6443
- ymax = 10 ** ymax
6444
- self .set_yscale ('log' )
6445
-
6446
6435
polygon = np .zeros ((6 , 2 ), float )
6447
6436
polygon [:,0 ] = sx * np .array ([ 0.5 , 0.5 , 0.0 , - 0.5 , - 0.5 , 0.0 ])
6448
6437
polygon [:,1 ] = sy * np .array ([- 0.5 , 0.5 , 1.0 , 0.5 , - 0.5 , - 1.0 ]) / 3.0
6449
6438
6450
6439
if edgecolors == 'none' :
6451
6440
edgecolors = 'face'
6452
6441
6453
- collection = mcoll .PolyCollection (
6454
- [polygon ],
6455
- edgecolors = edgecolors ,
6456
- linewidths = linewidths ,
6457
- offsets = offsets ,
6458
- transOffset = mtransforms .IdentityTransform (),
6459
- offset_position = "data"
6460
- )
6442
+ if xscale == 'log' or yscale == 'log' :
6443
+ polygons = np .expand_dims (polygon , 0 ) + np .expand_dims (offsets , 1 )
6444
+ if xscale == 'log' :
6445
+ polygons [:, :, 0 ] = 10.0 ** polygons [:, :, 0 ]
6446
+ xmin = 10.0 ** xmin
6447
+ xmax = 10.0 ** xmax
6448
+ self .set_xscale (xscale )
6449
+ if yscale == 'log' :
6450
+ polygons [:, :, 1 ] = 10.0 ** polygons [:, :, 1 ]
6451
+ ymin = 10.0 ** ymin
6452
+ ymax = 10.0 ** ymax
6453
+ self .set_yscale (yscale )
6454
+ collection = mcoll .PolyCollection (
6455
+ polygons ,
6456
+ edgecolors = edgecolors ,
6457
+ linewidths = linewidths ,
6458
+ )
6459
+ else :
6460
+ collection = mcoll .PolyCollection (
6461
+ [polygon ],
6462
+ edgecolors = edgecolors ,
6463
+ linewidths = linewidths ,
6464
+ offsets = offsets ,
6465
+ transOffset = mtransforms .IdentityTransform (),
6466
+ offset_position = "data"
6467
+ )
6461
6468
6462
6469
if isinstance (norm , mcolors .LogNorm ):
6463
6470
if (accum == 0 ).any ():
0 commit comments