def __set_baseparam(self, param, color, linestyle, linewidth, marker, markersize, markerfacecolor, markeredgecolor): """Apply parameters to a `guiqwt.styles.CurveParam` or `guiqwt.styles.MarkerParam` instance""" if color is not None: color = COLORS.get(color, color) # MATLAB-style param.line.color = color if linestyle is not None: param.line.set_style_from_matlab(linestyle) if linewidth is not None: param.line.width = linewidth if marker is not None: if marker in MARKERS: param.symbol.update_param(MARKERS[marker]) # MATLAB-style else: param.symbol.marker = marker if markersize is not None: param.symbol.size = markersize if markerfacecolor is not None: markerfacecolor = COLORS.get(markerfacecolor, markerfacecolor) # MATLAB-style param.symbol.facecolor = markerfacecolor if markeredgecolor is not None: markeredgecolor = COLORS.get(markeredgecolor, markeredgecolor) # MATLAB-style param.symbol.edgecolor = markeredgecolor
def gridparam(self, background=None, major_enabled=None, minor_enabled=None, major_style=None, minor_style=None): """ Make `guiqwt.styles.GridParam` instance * background = canvas background color * major_enabled = tuple (major_xenabled, major_yenabled) * minor_enabled = tuple (minor_xenabled, minor_yenabled) * major_style = tuple (major_xstyle, major_ystyle) * minor_style = tuple (minor_xstyle, minor_ystyle) Style: tuple (style, color, width) """ gridparam = GridParam(title=_("Grid"), icon="lin_lin.png") gridparam.read_config(CONF, "plot", "grid") if background is not None: gridparam.background = background if major_enabled is not None: gridparam.maj_xenabled, gridparam.maj_yenabled = major_enabled if minor_enabled is not None: gridparam.min_xenabled, gridparam.min_yenabled = minor_enabled if major_style is not None: style = LineStyleParam() linestyle, color, style.width = major_style style.set_style_from_matlab(linestyle) style.color = COLORS.get(color, color) # MATLAB-style if minor_style is not None: style = LineStyleParam() linestyle, color, style.width = minor_style style.set_style_from_matlab(linestyle) style.color = COLORS.get(color, color) # MATLAB-style return gridparam
def create_curves(self, labels, this_range, show_legend=True): self.curves = [] plot = self.get_plot() plot.del_all_items(except_grid=False) for i, l in enumerate(labels): param = CurveParam() param.label = str(l) color = COLORS.get(self.colors[i % len(self.colors)], self.colors[i % len(self.colors)]) param.line.color = color # create a new curve curve = CurveItemModel(param) self.curves.append(curve) plot.add_item(curve) curve.setRenderHint(QwtPlotItem.RenderAntialiased, USE_ANTIALIASING) l = make.legend("TR") if show_legend: plot.add_item(l) self.myranges = [] for r in this_range: self.add_range_to_plot(plot, r)
def create_curves(self, labels, this_range, show_legend=True): self.curves = [] plot = self.get_plot() plot.del_all_items(except_grid=False) for i,l in enumerate(labels): param = CurveParam() param.label = str(l) color = COLORS.get(self.colors[i % len(self.colors)], self.colors[i % len(self.colors)] ) param.line.color = color # create a new curve curve = CurveItemModel(param) self.curves.append(curve) plot.add_item( curve ) curve.setRenderHint(QwtPlotItem.RenderAntialiased, USE_ANTIALIASING) l = make.legend("TR") if show_legend: plot.add_item( l ) self.myranges = [] for r in this_range: self.add_range_to_plot(plot, r)