1212
1313
1414def is_figure (figure : Any ) -> bool :
15- """Check if the figure is a plotly go.Figure.
15+ """Check if the figure is a plotly go.Figure or a FigureResampler .
1616
1717 .. Note::
1818 This method does not use isinstance(figure, go.Figure) as this will not work
@@ -27,18 +27,18 @@ def is_figure(figure: Any) -> bool:
2727 Returns
2828 -------
2929 bool
30- True if the figure is a plotly go.Figure.
30+ True if the figure is a plotly go.Figure or a FigureResampler .
3131 """
3232
3333 return isinstance (figure , BaseFigure ) and (not isinstance (figure , BaseFigureWidget ))
3434
3535
36- def is_fr (figure : Any ) -> bool :
37- """Check if the figure is a plotly FigureResampler .
36+ def is_figurewidget (figure : Any ):
37+ """Check if the figure is a plotly go.FigureWidget or a FigureWidgetResampler .
3838
3939 .. Note::
40- This method does not use isinstance(figure, go.Figure ) as this will not work
41- when go.Figure is decorated (after executing the
40+ This method does not use isinstance(figure, go.FigureWidget ) as this will not
41+ work when go.FigureWidget is decorated (after executing the
4242 ``register_plotly_resampler`` function).
4343
4444 Parameters
@@ -49,20 +49,16 @@ def is_fr(figure: Any) -> bool:
4949 Returns
5050 -------
5151 bool
52- True if the figure is a plotly go.Figure .
52+ True if the figure is a plotly go.FigureWidget or a FigureWidgetResampler .
5353 """
54- from plotly_resampler import FigureResampler
55-
56- return isinstance (figure , FigureResampler )
54+ return isinstance (figure , BaseFigureWidget )
5755
5856
59- def is_fwr (figure : Any ) -> bool :
60- """Check if the figure is a plotly FigureWidgetResampler .
57+ def is_fr (figure : Any ) -> bool :
58+ """Check if the figure is a FigureResampler .
6159
6260 .. Note::
63- This method does not use isinstance(figure, go.Figure) as this will not work
64- when go.Figure is decorated (after executing the
65- ``register_plotly_resampler`` function).
61+ This method will not return True if the figure is a plotly go.Figure.
6662
6763 Parameters
6864 ----------
@@ -72,20 +68,18 @@ def is_fwr(figure: Any) -> bool:
7268 Returns
7369 -------
7470 bool
75- True if the figure is a plotly go.Figure .
71+ True if the figure is a FigureResampler .
7672 """
77- from plotly_resampler import FigureWidgetResampler
73+ from plotly_resampler import FigureResampler
7874
79- return isinstance (figure , FigureWidgetResampler )
75+ return isinstance (figure , FigureResampler )
8076
8177
82- def is_figurewidget (figure : Any ):
83- """Check if the figure is a plotly go.FigureWidget .
78+ def is_fwr (figure : Any ) -> bool :
79+ """Check if the figure is a FigureWidgetResampler .
8480
8581 .. Note::
86- This method does not use isinstance(figure, go.FigureWidget) as this will not
87- work when go.FigureWidget is decorated (after executing the
88- ``register_plotly_resampler`` function).
82+ This method will not return True if the figure is a plotly go.FigureWidget.
8983
9084 Parameters
9185 ----------
@@ -95,9 +89,11 @@ def is_figurewidget(figure: Any):
9589 Returns
9690 -------
9791 bool
98- True if the figure is a plotly go.FigureWidget .
92+ True if the figure is a FigureWidgetResampler .
9993 """
100- return isinstance (figure , BaseFigureWidget )
94+ from plotly_resampler import FigureWidgetResampler
95+
96+ return isinstance (figure , FigureWidgetResampler )
10197
10298
10399### Rounding functions for bin size
0 commit comments