(ax: Axes, x: np.ndarray, y: np.ndarray, color, alpha: np.ndarray, linewidth: float=1., linestyle: str="-", label: str | None = None)
| 201 | @as_chain_func |
| 202 | @IgnoreException |
| 203 | def plot_LinewithAlpha(ax: Axes, x: np.ndarray, y: np.ndarray, color, alpha: np.ndarray, linewidth: float=1., linestyle: str="-", label: str | None = None) -> Axes: |
| 204 | assert len(x.shape) == 1 |
| 205 | assert len(alpha.shape) == 1 |
| 206 | assert x.shape == y.shape |
| 207 | assert x.shape[0] == alpha.shape[0] + 1 |
| 208 | |
| 209 | positions = np.concatenate([x[:, np.newaxis], y[:, np.newaxis]], axis=1) |
| 210 | start_pos = positions[:-1] |
| 211 | end_pos = positions[1:] |
| 212 | line_collect = LineCollection(segments=[[ |
| 213 | (start_pos[idx, 0], start_pos[idx, 1]), (end_pos[idx, 0], end_pos[idx, 1]), |
| 214 | ] for idx in range(start_pos.shape[0])], label=label) |
| 215 | |
| 216 | line_collect.set_linewidth(linewidth) |
| 217 | line_collect.set_linestyle(linestyle) |
| 218 | line_collect.set_color(color) |
| 219 | line_collect.set_alpha(alpha.tolist()) |
| 220 | ax.add_collection(line_collect) |
| 221 | ax.set_xlim(min(x.min(), ax.get_xlim()[0]), max(x.max(), ax.get_xlim()[1])) |
| 222 | ax.set_ylim(min(y.min(), ax.get_ylim()[0]), max(y.max(), ax.get_ylim()[1])) |
| 223 | return ax |
| 224 | |
| 225 | @as_chain_func |
| 226 | @IgnoreException |
nothing calls this directly
no outgoing calls
no test coverage detected