def _create_joint_axis(self, figure=None, subplot_spec=None, figsize=None, textsize=None): figsize, ax_labelsize, _, xt_labelsize, linewidth, _ = _scale_fig_size( figsize, textsize) # Instantiate figure and grid if figure is None: fig = plt.figure(figsize=figsize, constrained_layout=True) else: fig = figure if subplot_spec is None: grid = plt.GridSpec(4, 4, hspace=0.1, wspace=0.1, figure=fig) else: grid = gridspect.GridSpecFromSubplotSpec(4, 4, subplot_spec=subplot_spec) # Set up main plot self.axjoin = fig.add_subplot(grid[1:, :-1]) # Set up top KDE self.ax_hist_x = fig.add_subplot(grid[0, :-1], sharex=self.axjoin) self.ax_hist_x.tick_params(labelleft=False, labelbottom=False) # Set up right KDE self.ax_hist_y = fig.add_subplot(grid[1:, -1], sharey=self.axjoin) self.ax_hist_y.tick_params(labelleft=False, labelbottom=False) sns.despine(left=True, bottom=True) return self.axjoin, self.ax_hist_x, self.ax_hist_y
def create_figure(self, figsize=None, textsize=None): figsize, self.ax_labelsize, _, self.xt_labelsize, self.linewidth, _ = _scale_fig_size( figsize, textsize) self.fig, self.axes = plt.subplots(0, 0, figsize=figsize, constrained_layout=True) # TODO make grid variable self.gs_0 = gridspect.GridSpec(3, 2, figure=self.fig, hspace=.1) return self.fig, self.axes, self.gs_0
def create_figure(self, marginal=True, likelihood=True, joyplot=True, figsize=None, textsize=None, n_samples=11): figsize, self.ax_labelsize, _, self.xt_labelsize, self.linewidth, _ = _scale_fig_size( figsize, textsize) self.fig, axes = plt.subplots(0, 0, figsize=figsize, constrained_layout=False) gs_0 = gridspect.GridSpec(3, 6, figure=self.fig, hspace=.1) if marginal is True: # Testing if likelihood is False: self.marginal_axes = self._create_joint_axis( figure=self.fig, subplot_spec=gs_0[0:2, 0:4]) elif likelihood is False and joyplot is False: self.marginal_axes = self._create_joint_axis( figure=self.fig, subplot_spec=gs_0[:, :]) else: self.marginal_axes = self._create_joint_axis( figure=self.fig, subplot_spec=gs_0[0:2, 0:3]) if likelihood is True: if marginal is False: self.likelihood_axes = self._create_likelihood_axis( figure=self.fig, subplot_spec=gs_0[0:2, 0:4]) elif joyplot is False: self.likelihood_axes = self._create_likelihood_axis( figure=self.fig, subplot_spec=gs_0[0:2, 4:]) else: self.likelihood_axes = self._create_likelihood_axis( figure=self.fig, subplot_spec=gs_0[0:1, 4:]) if joyplot is True: self.n_samples = n_samples if marginal is False and likelihood is False: self.joy = self._create_joy_axis(self.fig, gs_0[:, :]) else: self.joy = self._create_joy_axis(self.fig, gs_0[1:2, 4:])
def create_figure(self, figsize=None, textsize=None): """ Create the figure. Args: figsize: textsize: Returns: figure, list axes, subgrid values """ figsize, self.ax_labelsize, _, self.xt_labelsize, self.linewidth, _ = _scale_fig_size( figsize, textsize) self.fig, self.axes = plt.subplots(0, 0, figsize=figsize, constrained_layout=False) self.fig.is_legend = False # TODO make grid variable # self.gs_0 = gridspect.GridSpec(2, 2, figure=self.fig, hspace=.9) return self.fig, self.axes #, self.gs_0