Draws a horizontal line at the given level. Parameters ---------- level: float The level at which to draw the horizontal line. preserve_domain: boolean (default: False) If true, the line does not affect the domain of the 'y' scale.
(level, **kwargs)
| 451 | |
| 452 | |
| 453 | def hline(level, **kwargs): |
| 454 | """Draws a horizontal line at the given level. |
| 455 | |
| 456 | Parameters |
| 457 | ---------- |
| 458 | level: float |
| 459 | The level at which to draw the horizontal line. |
| 460 | preserve_domain: boolean (default: False) |
| 461 | If true, the line does not affect the domain of the 'y' scale. |
| 462 | """ |
| 463 | kwargs.setdefault('colors', ['dodgerblue']) |
| 464 | kwargs.setdefault('stroke_width', 1) |
| 465 | scales = kwargs.pop('scales', {}) |
| 466 | fig = kwargs.get('figure', current_figure()) |
| 467 | scales['x'] = fig.scale_x |
| 468 | |
| 469 | level = array(level) |
| 470 | if len(level.shape) == 0: |
| 471 | x = [0, 1] |
| 472 | y = [level, level] |
| 473 | else: |
| 474 | x = [0, 1] |
| 475 | y = column_stack([level, level]) |
| 476 | return plot(x, y, scales=scales, preserve_domain={ |
| 477 | 'x': True, |
| 478 | 'y': kwargs.get('preserve_domain', False) |
| 479 | }, axes=False, update_context=False, **kwargs) |
| 480 | |
| 481 | |
| 482 | def vline(level, **kwargs): |
nothing calls this directly
no test coverage detected
searching dependent graphs…