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

Class PaddedBox

lib/matplotlib/offsetbox.py:509–594  ·  view source on GitHub ↗

A container to add a padding around an `.Artist`. The `.PaddedBox` contains a `.FancyBboxPatch` that is used to visualize it when rendering. .. code-block:: none +----------------------------+ | | | |

Source from the content-addressed store, hash-verified

507
508
509class PaddedBox(OffsetBox):
510 """
511 A container to add a padding around an `.Artist`.
512
513 The `.PaddedBox` contains a `.FancyBboxPatch` that is used to visualize
514 it when rendering.
515
516 .. code-block:: none
517
518 +----------------------------+
519 | |
520 | |
521 | |
522 | <--pad--> Artist |
523 | ^ |
524 | pad |
525 | v |
526 +----------------------------+
527
528 Attributes
529 ----------
530 pad : float
531 The padding in points.
532 patch : `.FancyBboxPatch`
533 When *draw_frame* is True, this `.FancyBboxPatch` is made visible and
534 creates a border around the box.
535 """
536
537 def __init__(self, child, pad=0., *, draw_frame=False, patch_attrs=None):
538 """
539 Parameters
540 ----------
541 child : `~matplotlib.artist.Artist`
542 The contained `.Artist`.
543 pad : float, default: 0.0
544 The padding in points. This will be scaled with the renderer dpi.
545 In contrast, *width* and *height* are in *pixels* and thus not
546 scaled.
547 draw_frame : bool
548 Whether to draw the contained `.FancyBboxPatch`.
549 patch_attrs : dict or None
550 Additional parameters passed to the contained `.FancyBboxPatch`.
551 """
552 super().__init__()
553 self.pad = pad
554 self._children = [child]
555 self.patch = FancyBboxPatch(
556 xy=(0.0, 0.0), width=1., height=1.,
557 facecolor='w', edgecolor='k',
558 mutation_scale=1, # self.prop.get_size_in_points(),
559 snap=True,
560 visible=draw_frame,
561 boxstyle="square,pad=0",
562 )
563 if patch_attrs is not None:
564 self.patch.update(patch_attrs)
565
566 def _get_bbox_and_child_offsets(self, renderer):

Callers 2

test_paddedboxFunction · 0.90

Calls

no outgoing calls

Tested by 2

test_paddedboxFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…