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

Function subplot2grid

site-packages/matplotlib/pyplot.py:1224–1282  ·  view source on GitHub ↗

Create an axis at specific location inside a regular grid. Parameters ---------- shape : sequence of 2 ints Shape of grid in which to place axis. First entry is number of rows, second entry is number of columns. loc : sequence of 2 ints Location to plac

(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs)

Source from the content-addressed store, hash-verified

1222
1223
1224def subplot2grid(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs):
1225 """
1226 Create an axis at specific location inside a regular grid.
1227
1228 Parameters
1229 ----------
1230 shape : sequence of 2 ints
1231 Shape of grid in which to place axis.
1232 First entry is number of rows, second entry is number of columns.
1233
1234 loc : sequence of 2 ints
1235 Location to place axis within grid.
1236 First entry is row number, second entry is column number.
1237
1238 rowspan : int
1239 Number of rows for the axis to span to the right.
1240
1241 colspan : int
1242 Number of columns for the axis to span downwards.
1243
1244 fig : `Figure`, optional
1245 Figure to place axis in. Defaults to current figure.
1246
1247 **kwargs
1248 Additional keyword arguments are handed to `add_subplot`.
1249
1250
1251 Notes
1252 -----
1253 The following call ::
1254
1255 subplot2grid(shape, loc, rowspan=1, colspan=1)
1256
1257 is identical to ::
1258
1259 gridspec=GridSpec(shape[0], shape[1])
1260 subplotspec=gridspec.new_subplotspec(loc, rowspan, colspan)
1261 subplot(subplotspec)
1262 """
1263
1264 if fig is None:
1265 fig = gcf()
1266
1267 s1, s2 = shape
1268 subplotspec = GridSpec(s1, s2).new_subplotspec(loc,
1269 rowspan=rowspan,
1270 colspan=colspan)
1271 a = fig.add_subplot(subplotspec, **kwargs)
1272 bbox = a.bbox
1273 byebye = []
1274 for other in fig.axes:
1275 if other == a:
1276 continue
1277 if bbox.fully_overlaps(other.bbox):
1278 byebye.append(other)
1279 for ax in byebye:
1280 delaxes(ax)
1281

Callers

nothing calls this directly

Calls 7

GridSpecClass · 0.90
gcfFunction · 0.85
delaxesFunction · 0.85
new_subplotspecMethod · 0.80
add_subplotMethod · 0.80
fully_overlapsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected