MCPcopy Create free account
hub / github.com/dask/dask / visualize

Function visualize

dask/diagnostics/profile_visualize.py:81–155  ·  view source on GitHub ↗

Visualize the results of profiling in a bokeh plot. If multiple profilers are passed in, the plots are stacked vertically. Parameters ---------- profilers : profiler or list Profiler or list of profilers. filename : string, optional Name of the plot output file.

(
    profilers, filename="profile.html", show=True, save=None, mode=None, **kwargs
)

Source from the content-addressed store, hash-verified

79
80
81def visualize(
82 profilers, filename="profile.html", show=True, save=None, mode=None, **kwargs
83):
84 """Visualize the results of profiling in a bokeh plot.
85
86 If multiple profilers are passed in, the plots are stacked vertically.
87
88 Parameters
89 ----------
90 profilers : profiler or list
91 Profiler or list of profilers.
92 filename : string, optional
93 Name of the plot output file.
94 show : boolean, optional
95 If True (default), the plot is opened in a browser.
96 save : boolean, optional
97 If True (default when not in notebook), the plot is saved to disk.
98 mode : str, optional
99 BokehJS resource mode. Passed to ``bokeh.io.output_file()`` on Bokeh 3
100 and to ``bokeh.io.save()`` on Bokeh 4 and later.
101 **kwargs
102 Other keyword arguments, passed to bokeh.figure. These will override
103 all defaults set by visualize.
104
105 Returns
106 -------
107 The completed bokeh plot object.
108 """
109 bp = import_required("bokeh.plotting", _BOKEH_MISSING_MSG)
110
111 if "file_path" in kwargs:
112 warnings.warn(
113 "The file_path keyword argument is deprecated "
114 "and will be removed in a future release. "
115 "Please use filename instead.",
116 category=FutureWarning,
117 stacklevel=2,
118 )
119 filename = kwargs.pop("file_path")
120
121 if save is None:
122 save = not _bokeh_in_notebook()
123
124 if not isinstance(profilers, list):
125 profilers = [profilers]
126 figs = [prof._plot(**kwargs) for prof in profilers]
127 # Stack the plots
128 if len(figs) == 1:
129 p = figs[0]
130 else:
131 top = figs[0]
132 for f in figs[1:]:
133 f.x_range = top.x_range
134 f.title = None
135 f.min_border_top = 20
136 f.height -= 30
137 for f in figs[:-1]:
138 f.xaxis.axis_label = None

Callers 4

visualizeMethod · 0.90
visualizeMethod · 0.90
visualizeMethod · 0.90
test_plot_multipleFunction · 0.90

Calls 5

import_requiredFunction · 0.90
_bokeh_in_notebookFunction · 0.85
BOKEH_VERSIONFunction · 0.85
popMethod · 0.80
_plotMethod · 0.45

Tested by 1

test_plot_multipleFunction · 0.72