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

Class SubplotParams

lib/matplotlib/gridspec.py:741–807  ·  view source on GitHub ↗

Parameters defining the positioning of a subplots grid in a figure.

Source from the content-addressed store, hash-verified

739
740
741class SubplotParams:
742 """
743 Parameters defining the positioning of a subplots grid in a figure.
744 """
745
746 def __init__(self, left=None, bottom=None, right=None, top=None,
747 wspace=None, hspace=None):
748 """
749 Defaults are given by :rc:`figure.subplot.[name]`.
750
751 Parameters
752 ----------
753 left : float, optional
754 The position of the left edge of the subplots,
755 as a fraction of the figure width.
756 right : float, optional
757 The position of the right edge of the subplots,
758 as a fraction of the figure width.
759 bottom : float, optional
760 The position of the bottom edge of the subplots,
761 as a fraction of the figure height.
762 top : float, optional
763 The position of the top edge of the subplots,
764 as a fraction of the figure height.
765 wspace : float, optional
766 The width of the padding between subplots,
767 as a fraction of the average Axes width.
768 hspace : float, optional
769 The height of the padding between subplots,
770 as a fraction of the average Axes height.
771 """
772 for key in ["left", "bottom", "right", "top", "wspace", "hspace"]:
773 setattr(self, key, mpl.rcParams[f"figure.subplot.{key}"])
774 self.update(left, bottom, right, top, wspace, hspace)
775
776 def update(self, left=None, bottom=None, right=None, top=None,
777 wspace=None, hspace=None):
778 """
779 Update the dimensions of the passed parameters. *None* means unchanged.
780 """
781 if ((left if left is not None else self.left)
782 >= (right if right is not None else self.right)):
783 raise ValueError('left cannot be >= right')
784 if ((bottom if bottom is not None else self.bottom)
785 >= (top if top is not None else self.top)):
786 raise ValueError('bottom cannot be >= top')
787 if left is not None:
788 self.left = left
789 if right is not None:
790 self.right = right
791 if bottom is not None:
792 self.bottom = bottom
793 if top is not None:
794 self.top = top
795 if wspace is not None:
796 self.wspace = wspace
797 if hspace is not None:
798 self.hspace = hspace

Callers 3

__init__Method · 0.90
get_subplot_paramsMethod · 0.85
get_subplot_paramsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…