@@ -43,8 +43,53 @@ def __init__(
4343 verbose : bool = False ,
4444 show_dash_kwargs : dict | None = None ,
4545 ):
46+ """Initialize a dynamic aggregation data mirror using a dash web app.
47+
48+ Parameters
49+ ----------
50+ figure: BaseFigure
51+ The figure that will be decorated. Can be either an empty figure
52+ (e.g., ``go.Figure()``, ``make_subplots()``, ``go.FigureWidget``) or an
53+ existing figure.
54+ convert_existing_traces: bool
55+ A bool indicating whether the high-frequency traces of the passed ``figure``
56+ should be resampled, by default True. Hence, when set to False, the
57+ high-frequency traces of the passed ``figure`` will not be resampled.
58+ default_n_shown_samples: int, optional
59+ The default number of samples that will be shown for each trace,
60+ by default 1000.\n
61+ .. note::
62+ * This can be overridden within the :func:`add_trace` method.
63+ * If a trace withholds fewer datapoints than this parameter,
64+ the data will *not* be aggregated.
65+ default_downsampler: AbstractSeriesDownsampler
66+ An instance which implements the AbstractSeriesDownsampler interface and
67+ will be used as default downsampler, by default ``EfficientLTTB`` with
68+ _interleave_gaps_ set to True. \n
69+ .. note:: This can be overridden within the :func:`add_trace` method.
70+ resampled_trace_prefix_suffix: str, optional
71+ A tuple which contains the ``prefix`` and ``suffix``, respectively, which
72+ will be added to the trace its legend-name when a resampled version of the
73+ trace is shown. By default a bold, orange ``[R]`` is shown as prefix
74+ (no suffix is shown).
75+ show_mean_aggregation_size: bool, optional
76+ Whether the mean aggregation bin size will be added as a suffix to the trace
77+ its legend-name, by default True.
78+ convert_traces_kwargs: dict, optional
79+ A dict of kwargs that will be passed to the :func:`add_traces` method and
80+ will be used to convert the existing traces. \n
81+ .. note::
82+ This argument is only used when the passed ``figure`` contains data and
83+ ``convert_existing_traces`` is set to True.
84+ verbose: bool, optional
85+ Whether some verbose messages will be printed or not, by default False.
86+ show_dash_kwargs: dict, optional
87+ A dict that will be used as default kwargs for the :func:`show_dash` method.
88+ Note that the passed kwargs will be take precedence over these defaults.
89+
90+ """
4691 # Parse the figure input before calling `super`
47- if is_figure (figure ) and not is_fr (figure ):
92+ if is_figure (figure ) and not is_fr (figure ):
4893 # A go.Figure
4994 # => base case: the figure does not need to be adjusted
5095 f = figure
@@ -55,7 +100,7 @@ def __init__(
55100 f ._data_validator .set_uid = False
56101
57102 if isinstance (figure , BaseFigure ):
58- # A base figure object, can be;
103+ # A base figure object, can be;
59104 # - a go.FigureWidget
60105 # - a plotly-resampler figure: subclass of AbstractFigureAggregator
61106 # => we first copy the layout, grid_str and grid ref
@@ -75,7 +120,7 @@ def __init__(
75120 f ._grid_ref = figure .get ("_grid_ref" )
76121 f .add_traces (figure .get ("data" ))
77122 # `pr_props` is not None when loading a pickled plotly-resampler figure
78- f ._pr_props = figure .get ("pr_props" )
123+ f ._pr_props = figure .get ("pr_props" )
79124 # `f._pr_props`` is an attribute to store properties of a
80125 # plotly-resampler figure. This attribute is only used to pass
81126 # information to the super() constructor. Once the super constructor is
@@ -156,8 +201,8 @@ def show_dash(
156201 ``config`` parameter for this property in this method.
157202 See more https://dash.plotly.com/dash-core-components/graph
158203 **kwargs: dict
159- Additional app.run_server() kwargs. e.g.: port
160- Note that these kwargs take precedence over the ones passed to the
204+ Additional app.run_server() kwargs. e.g.: port, ...
205+ Also note that these kwargs take precedence over the ones passed to the
161206 constructor via the ``show_dash_kwargs`` argument.
162207
163208 """
@@ -183,7 +228,7 @@ def show_dash(
183228 and "height" not in kwargs
184229 ):
185230 # If app height is not specified -> re-use figure height for inline dash app
186- # Note: default layout height is 450 (whereas default app height is 650)
231+ # Note: default layout height is 450 (whereas default app height is 650)
187232 # See: https://plotly.com/python/reference/layout/#layout-height
188233 fig_height = self .layout .height if self .layout .height is not None else 450
189234 kwargs ["height" ] = fig_height + 18
0 commit comments