MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / SubplotTool

Class SubplotTool

site-packages/matplotlib/widgets.py:1085–1231  ·  view source on GitHub ↗

A tool to adjust the subplot params of a :class:`matplotlib.figure.Figure`.

Source from the content-addressed store, hash-verified

1083
1084
1085class SubplotTool(Widget):
1086 """
1087 A tool to adjust the subplot params of a :class:`matplotlib.figure.Figure`.
1088 """
1089 def __init__(self, targetfig, toolfig):
1090 """
1091 *targetfig*
1092 The figure instance to adjust.
1093
1094 *toolfig*
1095 The figure instance to embed the subplot tool into. If
1096 *None*, a default figure will be created. If you are using
1097 this from the GUI
1098 """
1099 # FIXME: The docstring seems to just abruptly end without...
1100
1101 self.targetfig = targetfig
1102 toolfig.subplots_adjust(left=0.2, right=0.9)
1103
1104 class toolbarfmt:
1105 def __init__(self, slider):
1106 self.slider = slider
1107
1108 def __call__(self, x, y):
1109 fmt = '%s=%s' % (self.slider.label.get_text(),
1110 self.slider.valfmt)
1111 return fmt % x
1112
1113 self.axleft = toolfig.add_subplot(711)
1114 self.axleft.set_title('Click on slider to adjust subplot param')
1115 self.axleft.set_navigate(False)
1116
1117 self.sliderleft = Slider(self.axleft, 'left',
1118 0, 1, targetfig.subplotpars.left,
1119 closedmax=False)
1120 self.sliderleft.on_changed(self.funcleft)
1121
1122 self.axbottom = toolfig.add_subplot(712)
1123 self.axbottom.set_navigate(False)
1124 self.sliderbottom = Slider(self.axbottom,
1125 'bottom', 0, 1,
1126 targetfig.subplotpars.bottom,
1127 closedmax=False)
1128 self.sliderbottom.on_changed(self.funcbottom)
1129
1130 self.axright = toolfig.add_subplot(713)
1131 self.axright.set_navigate(False)
1132 self.sliderright = Slider(self.axright, 'right', 0, 1,
1133 targetfig.subplotpars.right,
1134 closedmin=False)
1135 self.sliderright.on_changed(self.funcright)
1136
1137 self.axtop = toolfig.add_subplot(714)
1138 self.axtop.set_navigate(False)
1139 self.slidertop = Slider(self.axtop, 'top', 0, 1,
1140 targetfig.subplotpars.top,
1141 closedmin=False)
1142 self.slidertop.on_changed(self.functop)

Callers 9

subplot_toolFunction · 0.90
configure_subplotsMethod · 0.90
init_windowMethod · 0.90
configure_subplotsMethod · 0.90
init_windowMethod · 0.90
__init__Method · 0.90
configure_subplotsMethod · 0.90
configure_subplotsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected