(gid, obj)
| 276 | buf = fd.getvalue().decode() |
| 277 | |
| 278 | def include(gid, obj): |
| 279 | # we need to exclude certain objects which will not appear in the svg |
| 280 | if isinstance(obj, OffsetBox): |
| 281 | return False |
| 282 | if isinstance(obj, Text): |
| 283 | if obj.get_text() == "": |
| 284 | return False |
| 285 | elif obj.axes is None: |
| 286 | return False |
| 287 | if isinstance(obj, plt.Line2D): |
| 288 | xdata, ydata = obj.get_data() |
| 289 | if len(xdata) == len(ydata) == 1: |
| 290 | return False |
| 291 | elif not hasattr(obj, "axes") or obj.axes is None: |
| 292 | return False |
| 293 | if isinstance(obj, Tick): |
| 294 | loc = obj.get_loc() |
| 295 | if loc == 0: |
| 296 | return False |
| 297 | vi = obj.get_view_interval() |
| 298 | if loc < min(vi) or loc > max(vi): |
| 299 | return False |
| 300 | return True |
| 301 | |
| 302 | for gid, obj in gdic.items(): |
| 303 | if include(gid, obj): |
no test coverage detected
searching dependent graphs…