@@ -5443,7 +5443,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
54435443 lines_kw ['transform' ] = kwargs ['transform' ]
54445444 if 'zorder' in kwargs :
54455445 lines_kw ['zorder' ] = kwargs ['zorder' ]
5446-
5446+
54475447 # arrays fine here, they are booleans and hence not units
54485448 if not iterable (lolims ):
54495449 lolims = np .asarray ([lolims ]* len (x ), bool )
@@ -6432,32 +6432,39 @@ def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
64326432 offsets = offsets [good_idxs ,:]
64336433 accum = accum [good_idxs ]
64346434
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-
64466435 polygon = np .zeros ((6 , 2 ), float )
64476436 polygon [:,0 ] = sx * np .array ([ 0.5 , 0.5 , 0.0 , - 0.5 , - 0.5 , 0.0 ])
64486437 polygon [:,1 ] = sy * np .array ([- 0.5 , 0.5 , 1.0 , 0.5 , - 0.5 , - 1.0 ]) / 3.0
64496438
64506439 if edgecolors == 'none' :
64516440 edgecolors = 'face'
64526441
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+ )
64616468
64626469 if isinstance (norm , mcolors .LogNorm ):
64636470 if (accum == 0 ).any ():
0 commit comments