Set the position of the spine. Spine position is specified by a 2 tuple of (position type, amount). The position types are: * 'outward': place the spine out from the data area by the specified number of points. (Negative values place the spine inwards.)
(self, position)
| 314 | return ret |
| 315 | |
| 316 | def set_position(self, position): |
| 317 | """ |
| 318 | Set the position of the spine. |
| 319 | |
| 320 | Spine position is specified by a 2 tuple of (position type, |
| 321 | amount). The position types are: |
| 322 | |
| 323 | * 'outward': place the spine out from the data area by the specified |
| 324 | number of points. (Negative values place the spine inwards.) |
| 325 | * 'axes': place the spine at the specified Axes coordinate (0 to 1). |
| 326 | * 'data': place the spine at the specified data coordinate. |
| 327 | |
| 328 | Additionally, shorthand notations define a special positions: |
| 329 | |
| 330 | * 'center' -> ``('axes', 0.5)`` |
| 331 | * 'zero' -> ``('data', 0.0)`` |
| 332 | |
| 333 | Examples |
| 334 | -------- |
| 335 | :doc:`/gallery/spines/spine_placement_demo` |
| 336 | """ |
| 337 | if position in ('center', 'zero'): # special positions |
| 338 | pass |
| 339 | else: |
| 340 | if len(position) != 2: |
| 341 | raise ValueError("position should be 'center' or 2-tuple") |
| 342 | if position[0] not in ['outward', 'axes', 'data']: |
| 343 | raise ValueError("position[0] should be one of 'outward', " |
| 344 | "'axes', or 'data' ") |
| 345 | self._position = position |
| 346 | self.set_transform(self.get_spine_transform()) |
| 347 | if self.axis is not None: |
| 348 | self.axis.reset_ticks() |
| 349 | self.stale = True |
| 350 | |
| 351 | def get_position(self): |
| 352 | """Return the spine position.""" |
no test coverage detected