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)
| 9 | |
| 10 | |
| 11 | def 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 | |
| 48 | def create_annotated_heatmap( |
no outgoing calls
no test coverage detected