MCPcopy Index your code
hub / github.com/plotly/plotly.py / validate_annotated_heatmap

Function validate_annotated_heatmap

plotly/figure_factory/_annotated_heatmap.py:11–45  ·  view source on GitHub ↗

Annotated-heatmap-specific validations Check that if a text matrix is supplied, it has the same dimensions as the z matrix. See FigureFactory.create_annotated_heatmap() for params :raises: (PlotlyError) If z and text matrices do not have the same dimensions.

(z, x, y, annotation_text)

Source from the content-addressed store, hash-verified

9
10
11def validate_annotated_heatmap(z, x, y, annotation_text):
12 """
13 Annotated-heatmap-specific validations
14
15 Check that if a text matrix is supplied, it has the same
16 dimensions as the z matrix.
17
18 See FigureFactory.create_annotated_heatmap() for params
19
20 :raises: (PlotlyError) If z and text matrices do not have the same
21 dimensions.
22 """
23 if annotation_text is not None and isinstance(annotation_text, list):
24 utils.validate_equal_length(z, annotation_text)
25 for lst in range(len(z)):
26 if len(z[lst]) != len(annotation_text[lst]):
27 raise exceptions.PlotlyError(
28 "z and text should have the same dimensions"
29 )
30
31 if x:
32 if len(x) != len(z[0]):
33 raise exceptions.PlotlyError(
34 "oops, the x list that you "
35 "provided does not match the "
36 "width of your z matrix "
37 )
38
39 if y:
40 if len(y) != len(z):
41 raise exceptions.PlotlyError(
42 "oops, the y list that you "
43 "provided does not match the "
44 "length of your z matrix "
45 )
46
47
48def create_annotated_heatmap(

Callers 1

create_annotated_heatmapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected