Refer to FigureFactory.create_scatterplotmatrix() for docstring Returns fig for scatterplotmatrix without index
(dataframe, headers, diag, size, height, width, title, **kwargs)
| 143 | |
| 144 | |
| 145 | def scatterplot(dataframe, headers, diag, size, height, width, title, **kwargs): |
| 146 | """ |
| 147 | Refer to FigureFactory.create_scatterplotmatrix() for docstring |
| 148 | |
| 149 | Returns fig for scatterplotmatrix without index |
| 150 | |
| 151 | """ |
| 152 | dim = len(dataframe) |
| 153 | fig = make_subplots(rows=dim, cols=dim, print_grid=False) |
| 154 | trace_list = [] |
| 155 | # Insert traces into trace_list |
| 156 | for listy in dataframe: |
| 157 | for listx in dataframe: |
| 158 | if (listx == listy) and (diag == "histogram"): |
| 159 | trace = graph_objs.Histogram(x=listx, showlegend=False) |
| 160 | elif (listx == listy) and (diag == "box"): |
| 161 | trace = graph_objs.Box(y=listx, name=None, showlegend=False) |
| 162 | else: |
| 163 | if "marker" in kwargs: |
| 164 | kwargs["marker"]["size"] = size |
| 165 | trace = graph_objs.Scatter( |
| 166 | x=listx, y=listy, mode="markers", showlegend=False, **kwargs |
| 167 | ) |
| 168 | trace_list.append(trace) |
| 169 | else: |
| 170 | trace = graph_objs.Scatter( |
| 171 | x=listx, |
| 172 | y=listy, |
| 173 | mode="markers", |
| 174 | marker=dict(size=size), |
| 175 | showlegend=False, |
| 176 | **kwargs, |
| 177 | ) |
| 178 | trace_list.append(trace) |
| 179 | |
| 180 | trace_index = 0 |
| 181 | indices = range(1, dim + 1) |
| 182 | for y_index in indices: |
| 183 | for x_index in indices: |
| 184 | fig.append_trace(trace_list[trace_index], y_index, x_index) |
| 185 | trace_index += 1 |
| 186 | |
| 187 | # Insert headers into the figure |
| 188 | for j in range(dim): |
| 189 | xaxis_key = "xaxis{}".format((dim * dim) - dim + 1 + j) |
| 190 | fig["layout"][xaxis_key].update(title=headers[j]) |
| 191 | for j in range(dim): |
| 192 | yaxis_key = "yaxis{}".format(1 + (dim * j)) |
| 193 | fig["layout"][yaxis_key].update(title=headers[j]) |
| 194 | |
| 195 | fig["layout"].update(height=height, width=width, title=title, showlegend=True) |
| 196 | |
| 197 | hide_tick_labels_from_box_subplots(fig) |
| 198 | |
| 199 | return fig |
| 200 | |
| 201 | |
| 202 | def scatterplot_dict( |
no test coverage detected