MCPcopy Create free account
hub / github.com/holoviz/hvplot / __call__

Method __call__

hvplot/interactive.py:506–566  ·  view source on GitHub ↗

The `.interactive` API enhances the API of data analysis libraries like Pandas, Dask, and Xarray, by allowing to replace in a pipeline static values by dynamic widgets. When displayed, an interactive pipeline will incorporate the dynamic widgets that control it, as l

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

504 return get_ax
505
506 def __call__(self, *args, **kwargs):
507 """
508 The `.interactive` API enhances the API of data analysis libraries
509 like Pandas, Dask, and Xarray, by allowing to replace in a pipeline
510 static values by dynamic widgets. When displayed, an interactive
511 pipeline will incorporate the dynamic widgets that control it, as long
512 as its normal output that will automatically be updated as soon as a
513 widget value is changed.
514
515 Reference: https://hvplot.holoviz.org/user_guide/Interactive.html
516
517 Parameters
518 ----------
519 loc : str, optional
520 Widget(s) location, one of 'bottom_left', 'bottom_right', 'right'
521 'top-right', 'top-left' and 'left'. By default 'top_left'
522 center : bool, optional
523 Whether to center to pipeline output, by default False
524 max_rows : int, optional
525 Maximum number of rows displayed, only used when the output is a
526 dataframe, by default 100
527 kwargs: optional
528 Optional kwargs that are passed down to customize the displayed
529 object. E.g. if the output is a DataFrame `width=200` will set
530 the size of the DataFrame Pane that renders it.
531
532 Returns
533 -------
534 Interactive
535 The next `Interactive` object of the pipeline.
536
537 Examples
538 --------
539 >>> widget = panel.widgets.IntSlider(value=1, start=1, end=5)
540 >>> dfi = df.interactive(width=200)
541 >>> dfi.head(widget)
542 """
543
544 if self._method is None:
545 if self._depth == 0:
546 # This code path is entered when initializing an interactive
547 # class from the accessor, e.g. with df.interactive(). As
548 # calling the accessor df.interactive already returns an
549 # Interactive instance.
550 return self._clone(*args, **kwargs)
551 # TODO: When is this error raised?
552 raise AttributeError
553 elif self._method == 'plot':
554 # This - {ax: get_ax} - is passed as kwargs to the plot method in
555 # the dim expression.
556 kwargs['ax'] = self._get_ax_fn()
557 new = self._clone(copy=True)
558 try:
559 method = type(new._transform)(new._transform, new._method, accessor=True)
560 kwargs = dict(new._inherit_kwargs, **kwargs)
561 clone = new._clone(method(*args, **kwargs), plot=new._method == 'plot')
562 finally:
563 # If an error occurs reset _method anyway so that, e.g. the next

Callers

nothing calls this directly

Calls 2

_cloneMethod · 0.95
_get_ax_fnMethod · 0.95

Tested by

no test coverage detected