def _set_number_of_plots(self, n):
<EOL>if self.button_multi.is_checked()and len(self._curves) == len(self.plot_widgets)and len(self._curves) == n: return<EOL>if not self.button_multi.is_checked()and len(self.plot_widgets) == <NUM_LIT:1>and len(self._curves) == n: return<EOL>self.grid_plot.block_events()<EOL>while len(self._curves) > n: self._curves.pop(-<NUM_LIT:1>)<EOL>while len(self._curves) < n: self._curves.append(_g.PlotCurveItem(pen = (len(self._curves), n)))<EOL>if self.button_multi.is_checked(): n_plots = n<EOL>else:                              n_plots = min(n,<NUM_LIT:1>)<EOL>while len(self.plot_widgets):<EOL><INDENT>p = self.plot_widgets.pop(-<NUM_LIT:1>)<EOL>p.clear()<EOL>self.grid_plot.remove_object(p)<EOL><DEDENT>for i in range(n_plots):<EOL><INDENT>self.plot_widgets.append(self.grid_plot.place_object(_g.PlotWidget(), <NUM_LIT:0>, i, alignment=<NUM_LIT:0>))<EOL><DEDENT>for i in range(n):<EOL><INDENT>self.plot_widgets[min(i,len(self.plot_widgets)-<NUM_LIT:1>)].addItem(self._curves[i])<EOL><DEDENT>if self.ROIs is not None:<EOL><INDENT>for i in range(len(self.ROIs)):<EOL><INDENT>ROIs = self.ROIs[i]<EOL>if not _spinmob.fun.is_iterable(ROIs): ROIs = [ROIs]<EOL>for ROI in ROIs:<EOL><INDENT>m = min(i, len(self.plot_widgets)-<NUM_LIT:1>)<EOL>if m>=<NUM_LIT:0>: self.plot_widgets[m].addItem(ROI)<EOL><DEDENT><DEDENT><DEDENT>self.grid_plot.unblock_events()<EOL>
Adjusts number of plots & curves to the desired value the gui.