MCPcopy Index your code
hub / github.com/bqplot/bqplot / plot

Function plot

bqplot/pyplot.py:630–700  ·  view source on GitHub ↗

Draw lines in the current context figure. Signature: `plot(x, y, **kwargs)` or `plot(y, **kwargs)`, depending of the length of the list of positional arguments. In the case where the `x` array is not provided. Parameters ---------- x: numpy.ndarray or list, 1d or 2d (option

(*args, **kwargs)

Source from the content-addressed store, hash-verified

628
629@_process_data('color')
630def plot(*args, **kwargs):
631 """Draw lines in the current context figure.
632
633 Signature: `plot(x, y, **kwargs)` or `plot(y, **kwargs)`, depending of the
634 length of the list of positional arguments. In the case where the `x` array
635 is not provided.
636
637 Parameters
638 ----------
639 x: numpy.ndarray or list, 1d or 2d (optional)
640 The x-coordinates of the plotted line. When not provided, the function
641 defaults to `numpy.arange(len(y))`
642 x can be 1-dimensional or 2-dimensional.
643 y: numpy.ndarray or list, 1d or 2d
644 The y-coordinates of the plotted line. If argument `x` is 2-dimensional
645 it must also be 2-dimensional.
646 marker_str: string
647 string representing line_style, marker and color.
648 For e.g. 'g--o', 'sr' etc
649 options: dict (default: {})
650 Options for the scales to be created. If a scale labeled 'x' is
651 required for that mark, options['x'] contains optional keyword
652 arguments for the constructor of the corresponding scale type.
653 axes_options: dict (default: {})
654 Options for the axes to be created. If an axis labeled 'x' is required
655 for that mark, axes_options['x'] contains optional keyword arguments
656 for the constructor of the corresponding axis type.
657 figure: Figure or None
658 The figure to which the line is to be added.
659 If the value is None, the current figure is used.
660 """
661 marker_str = None
662 if len(args) == 1:
663 kwargs['y'] = args[0]
664 if kwargs.get('index_data', None) is not None:
665 kwargs['x'] = kwargs['index_data']
666 else:
667 kwargs['x'] = _infer_x_for_line(args[0])
668 elif len(args) == 2:
669 if isinstance(args[1], str):
670 kwargs['y'] = args[0]
671 kwargs['x'] = _infer_x_for_line(args[0])
672 marker_str = args[1].strip()
673 else:
674 kwargs['x'] = args[0]
675 kwargs['y'] = args[1]
676 elif len(args) == 3:
677 kwargs['x'] = args[0]
678 kwargs['y'] = args[1]
679 if isinstance(args[2], str):
680 marker_str = args[2].strip()
681
682 if marker_str:
683 line_style, color, marker = _get_line_styles(marker_str)
684
685 # only marker specified => draw scatter
686 if marker and not line_style:
687 kwargs['marker'] = marker

Callers 2

hlineFunction · 0.85
vlineFunction · 0.85

Calls 3

_infer_x_for_lineFunction · 0.85
_get_line_stylesFunction · 0.85
_draw_markFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…