Build matplotlib figure of surface plot Parameters ---------- figsize : tuple, optional Overall figure size, specified by (width, height). Default: None, which will determine the figure size based on the `size` parameter. colorbar : bool, opt
(self, figsize=None, colorbar=True, cbar_kws=None, scale=(2, 2))
| 483 | cb.ax.tick_params(size=0) |
| 484 | |
| 485 | def build(self, figsize=None, colorbar=True, cbar_kws=None, scale=(2, 2)): |
| 486 | """Build matplotlib figure of surface plot |
| 487 | |
| 488 | Parameters |
| 489 | ---------- |
| 490 | figsize : tuple, optional |
| 491 | Overall figure size, specified by (width, height). Default: None, |
| 492 | which will determine the figure size based on the `size` parameter. |
| 493 | colorbar : bool, optional |
| 494 | Draw colorbars for each applicable layer, default: True |
| 495 | cbar_kws : dict, optional |
| 496 | Keyword arguments for |
| 497 | :func:`~surfplot.plottong.Plot._add_colorbar`. Default: None, |
| 498 | which will plot the default colorbar parameters. |
| 499 | scale : tuple, optional |
| 500 | Amount to scale the surface plot. Default: (2, 2), which is a |
| 501 | good baseline for higher resolution plotting. |
| 502 | |
| 503 | Returns |
| 504 | ------- |
| 505 | matplotlib.pyplot.figure |
| 506 | Surface plot figure |
| 507 | """ |
| 508 | p = self.render() |
| 509 | p._check_offscreen() |
| 510 | x = p.to_numpy(transparent_bg=True, scale=scale) |
| 511 | |
| 512 | if figsize is None: |
| 513 | figsize = tuple((np.array(self.size) / 100) + 1) |
| 514 | |
| 515 | fig, ax = plt.subplots(figsize=figsize) |
| 516 | ax.imshow(x) |
| 517 | ax.axis('off') |
| 518 | if colorbar: |
| 519 | cbar_kws = {} if cbar_kws is None else cbar_kws |
| 520 | self._add_colorbars(**cbar_kws) |
| 521 | |
| 522 | return fig |
| 523 | |
| 524 | def show(self, embed_nb=False, interactive=True, transparent_bg=True, |
| 525 | scale=(1, 1)): |
no test coverage detected