Contour trace in Cartesian coordinates. Parameters ========== x, y : array-like Cartesian coordinates z : array-like Field to be represented as contours. ncontours : int or None Number of contours to display (determined automatically if None). c
(
x,
y,
z,
ncontours=None,
colorscale="Electric",
linecolor="rgb(150,150,150)",
interp_mode="ilr",
coloring=None,
v_min=0,
v_max=1,
)
| 376 | |
| 377 | |
| 378 | def _contour_trace( |
| 379 | x, |
| 380 | y, |
| 381 | z, |
| 382 | ncontours=None, |
| 383 | colorscale="Electric", |
| 384 | linecolor="rgb(150,150,150)", |
| 385 | interp_mode="ilr", |
| 386 | coloring=None, |
| 387 | v_min=0, |
| 388 | v_max=1, |
| 389 | ): |
| 390 | """ |
| 391 | Contour trace in Cartesian coordinates. |
| 392 | |
| 393 | Parameters |
| 394 | ========== |
| 395 | |
| 396 | x, y : array-like |
| 397 | Cartesian coordinates |
| 398 | z : array-like |
| 399 | Field to be represented as contours. |
| 400 | ncontours : int or None |
| 401 | Number of contours to display (determined automatically if None). |
| 402 | colorscale : None or str (Plotly colormap) |
| 403 | colorscale of the contours. |
| 404 | linecolor : rgb color |
| 405 | Color used for lines. If ``colorscale`` is not None, line colors are |
| 406 | determined from ``colorscale`` instead. |
| 407 | interp_mode : 'ilr' (default) or 'cartesian' |
| 408 | Defines how data are interpolated to compute contours. If 'irl', |
| 409 | ILR (Isometric Log-Ratio) of compositional data is performed. If |
| 410 | 'cartesian', contours are determined in Cartesian space. |
| 411 | coloring : None or 'lines' |
| 412 | How to display contour. Filled contours if None, lines if ``lines``. |
| 413 | vmin, vmax : float |
| 414 | Bounds of interval of values used for the colorspace |
| 415 | |
| 416 | Notes |
| 417 | ===== |
| 418 | """ |
| 419 | # Prepare colors |
| 420 | # We do not take extrema, for example for one single contour |
| 421 | # the color will be the middle point of the colormap |
| 422 | colors = _colors(ncontours + 2, colorscale) |
| 423 | # Values used for contours, extrema are not used |
| 424 | # For example for a binary array [0, 1], the value of |
| 425 | # the contour for ncontours=1 is 0.5. |
| 426 | values = np.linspace(v_min, v_max, ncontours + 2) |
| 427 | color_min, color_max = colors[0], colors[-1] |
| 428 | colors = colors[1:-1] |
| 429 | values = values[1:-1] |
| 430 | |
| 431 | # Color of line contours |
| 432 | if linecolor is None: |
| 433 | linecolor = "rgb(150, 150, 150)" |
| 434 | else: |
| 435 | colors = [linecolor] * ncontours |
no test coverage detected