@@ -98,25 +98,26 @@ def __init__(self, nonpos='clip'):
9898 self ._clip = {"clip" : True , "mask" : False }[nonpos ]
9999
100100 def transform_non_affine (self , a ):
101+ # Ignore invalid values due to nans being passed to the transform
101102 with np .errstate (divide = "ignore" , invalid = "ignore" ):
102103 out = np .log (a )
103- out /= np .log (self .base )
104- if self ._clip :
105- # SVG spec says that conforming viewers must support values up
106- # to 3.4e38 (C float); however experiments suggest that Inkscape
107- # (which uses cairo for rendering) runs into cairo's 24-bit limit
108- # (which is apparently shared by Agg).
109- # Ghostscript (used for pdf rendering appears to overflow even
110- # earlier, with the max value around 2 ** 15 for the tests to pass.
111- # On the other hand, in practice, we want to clip beyond
112- # np.log10(np.nextafter(0, 1)) ~ -323
113- # so 1000 seems safe.
114- out [a <= 0 ] = - 1000
104+ out /= np .log (self .base )
105+ if self ._clip :
106+ # SVG spec says that conforming viewers must support values up
107+ # to 3.4e38 (C float); however experiments suggest that
108+ # Inkscape (which uses cairo for rendering) runs into cairo's
109+ # 24-bit limit (which is apparently shared by Agg).
110+ # Ghostscript (used for pdf rendering appears to overflow even
111+ # earlier, with the max value around 2 ** 15 for the tests to
112+ # pass. On the other hand, in practice, we want to clip beyond
113+ # np.log10(np.nextafter(0, 1)) ~ -323
114+ # so 1000 seems safe.
115+ out [a <= 0 ] = - 1000
115116 return out
116117
117118 def __str__ (self ):
118- return "{}({!r})" .format (type ( self ). __name__ ,
119- "clip" if self ._clip else "mask" )
119+ return "{}
4F06
({!r})" .format (
120+ type ( self ). __name__ , "clip" if self ._clip else "mask" )
120121
121122
122123class InvertedLogTransformBase (Transform ):
0 commit comments