MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _plot_args

Method _plot_args

lib/matplotlib/axes/_base.py:411–554  ·  view source on GitHub ↗

Process the arguments of ``plot([x], y, [fmt], **kwargs)`` calls. This processes a single set of ([x], y, [fmt]) parameters; i.e. for ``plot(x, y, x2, y2)`` it will be called twice. Once for (x, y) and once for (x2, y2). x and y may be 2D and thus can still

(self, axes, tup, kwargs, *,
                   return_kwargs=False, ambiguous_fmt_datakey=False)

Source from the content-addressed store, hash-verified

409 return seg, kwargs
410
411 def _plot_args(self, axes, tup, kwargs, *,
412 return_kwargs=False, ambiguous_fmt_datakey=False):
413 """
414 Process the arguments of ``plot([x], y, [fmt], **kwargs)`` calls.
415
416 This processes a single set of ([x], y, [fmt]) parameters; i.e. for
417 ``plot(x, y, x2, y2)`` it will be called twice. Once for (x, y) and
418 once for (x2, y2).
419
420 x and y may be 2D and thus can still represent multiple datasets.
421
422 For multiple datasets, if the keyword argument *label* is a list, this
423 will unpack the list and assign the individual labels to the datasets.
424
425 Parameters
426 ----------
427 tup : tuple
428 A tuple of the positional parameters. This can be one of
429
430 - (y,)
431 - (x, y)
432 - (y, fmt)
433 - (x, y, fmt)
434
435 kwargs : dict
436 The keyword arguments passed to ``plot()``.
437
438 return_kwargs : bool
439 Whether to also return the effective keyword arguments after label
440 unpacking as well.
441
442 ambiguous_fmt_datakey : bool
443 Whether the format string in *tup* could also have been a
444 misspelled data key.
445
446 Returns
447 -------
448 result
449 If *return_kwargs* is false, a list of Artists representing the
450 dataset(s).
451 If *return_kwargs* is true, a list of (Artist, effective_kwargs)
452 representing the dataset(s). See *return_kwargs*.
453 The Artist is either `.Line2D` (if called from ``plot()``) or
454 `.Polygon` otherwise.
455 """
456 if len(tup) > 1 and isinstance(tup[-1], str):
457 # xy is tup with fmt stripped (could still be (y,) only)
458 *xy, fmt = tup
459 linestyle, marker, color = _process_plot_format(
460 fmt, ambiguous_fmt_datakey=ambiguous_fmt_datakey)
461 elif len(tup) == 3:
462 raise ValueError('third arg must be a format string')
463 else:
464 xy = tup
465 linestyle, marker, color = None, None, None
466
467 # Don't allow any None value; these would be up-converted to one
468 # element array of None which causes problems downstream.

Callers 3

__call__Method · 0.95
errorbarMethod · 0.80
errorbarMethod · 0.80

Calls 5

_check_1dFunction · 0.90
index_ofFunction · 0.90
_process_plot_formatFunction · 0.85
update_unitsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected