(name='hvplot', interactive='interactive', extension='bokeh', logo=False)
| 39 | |
| 40 | |
| 41 | def patch(name='hvplot', interactive='interactive', extension='bokeh', logo=False): |
| 42 | from . import hvPlot, post_patch, _module_extensions |
| 43 | |
| 44 | try: |
| 45 | import xarray as xr |
| 46 | except ImportError: |
| 47 | raise ImportError( |
| 48 | 'Could not patch plotting API onto xarray. xarray could not be imported.' |
| 49 | ) |
| 50 | |
| 51 | # Remove the class docstring as it very developer focused |
| 52 | XArrayInteractive.__doc__ = '' |
| 53 | |
| 54 | if 'hvplot.xarray' not in _module_extensions: |
| 55 | xr.register_dataset_accessor(name)(hvPlot) |
| 56 | xr.register_dataarray_accessor(name)(hvPlot) |
| 57 | xr.register_dataset_accessor(interactive)(XArrayInteractive) |
| 58 | xr.register_dataarray_accessor(interactive)(XArrayInteractive) |
| 59 | _module_extensions.add('hvplot.xarray') |
| 60 | |
| 61 | post_patch(extension, logo) |
| 62 | |
| 63 | |
| 64 | patch() |
no test coverage detected
searching dependent graphs…