Draws a vertical line at the given level. Parameters ---------- level: float The level at which to draw the vertical line. preserve_domain: boolean (default: False) If true, the line does not affect the domain of the 'x' scale.
(level, **kwargs)
| 480 | |
| 481 | |
| 482 | def vline(level, **kwargs): |
| 483 | """Draws a vertical line at the given level. |
| 484 | |
| 485 | Parameters |
| 486 | ---------- |
| 487 | level: float |
| 488 | The level at which to draw the vertical line. |
| 489 | preserve_domain: boolean (default: False) |
| 490 | If true, the line does not affect the domain of the 'x' scale. |
| 491 | """ |
| 492 | kwargs.setdefault('colors', ['dodgerblue']) |
| 493 | kwargs.setdefault('stroke_width', 1) |
| 494 | scales = kwargs.pop('scales', {}) |
| 495 | fig = kwargs.get('figure', current_figure()) |
| 496 | scales['y'] = fig.scale_y |
| 497 | |
| 498 | level = array(level) |
| 499 | if len(level.shape) == 0: |
| 500 | x = [level, level] |
| 501 | y = [0, 1] |
| 502 | else: |
| 503 | x = column_stack([level, level]) |
| 504 | # TODO: repeating [0, 1] should not be required once we allow for |
| 505 | # 2-D x and 1-D y |
| 506 | y = [[0, 1]] * len(level) |
| 507 | return plot(x, y, scales=scales, preserve_domain={ |
| 508 | 'x': kwargs.get('preserve_domain', False), |
| 509 | 'y': True |
| 510 | }, axes=False, update_context=False, **kwargs) |
| 511 | |
| 512 | |
| 513 | def _process_cmap(cmap): |
nothing calls this directly
no test coverage detected
searching dependent graphs…