def _plot(self, ax, F): # equal axis length and no ticks equal_axis(ax) no_ticks(ax) V = get_circle_points(len(F)) # sections to plot sections = np.linspace(0, 2 * np.pi, self.n_dim + 1) t = [(sections[i] + sections[i + 1]) / 2 for i in range(len(sections) - 1)] endpoints = np.column_stack([np.cos(t), np.sin(t)]) plot_axis_labels(ax, endpoints, self.get_labels(), **self.axis_label_style) center = np.zeros(2) for i in range(len(sections) - 1): t = np.linspace(sections[i], sections[i + 1], 100) v = np.column_stack([np.cos(t), np.sin(t)]) P = np.row_stack([center, F[i] * v]) plot_polygon(ax, P, color=self.colors[i]) # draw the outer circle plot_circle(ax, **self.axis_style) plot_axes_lines(ax, V, **self.axis_style)
def _do(self): if self.bounds is None: raise Exception("The boundaries must be provided.") _F = np.row_stack([e[0] for e in self.to_plot]) if np.any(_F < self.bounds[0]) or np.any(_F > self.bounds[1]): raise Exception( "Points out of the boundaries exist! Please make sure the boundaries are indeed boundaries.") n_rows = len(self.to_plot) n_cols = max([len(e[0]) for e in self.to_plot]) self.init_figure(n_rows=n_rows, n_cols=n_cols, force_axes_as_matrix=True) # normalize the input bounds = parse_bounds(self.bounds, self.n_dim) to_plot_norm = normalize(self.to_plot, bounds, reverse=self.reverse) # get the endpoints of circle V = get_circle_points(self.n_dim) if self.normalize_each_objective: inner = np.zeros((self.n_dim, 1)) * V outer = np.ones((self.n_dim, 1)) * V else: inner = bounds[[0]].T * V outer = (bounds[[1]].T * V) / bounds[1].max() for k, (F, kwargs) in enumerate(to_plot_norm): for j, _F in enumerate(F): self._plot(self.ax[k, j], _F, inner, outer, kwargs)