def customize_shape(shape): global STYLE param = shape.shapeparam style = next(STYLE) update_style_attr(style, param) param.update_shape(shape) shape.plot().replot()
def mcurve(self, *args, **kwargs): """ Make a curve `plot item` based on MATLAB-like syntax (may returns a list of curves if data contains more than one signal) (:py:class:`guiqwt.curve.CurveItem` object) Example:: mcurve(x, y, 'r+') """ x, y, style = self.__get_arg_triple_plot(args) if isinstance(y, ndarray): y = [y] if not isinstance(style, list): style = [style] if len(y) > len(style): style = [style[0]] * len(y) basename = _("Curve") curves = [] for yi, stylei in zip(y, style): param = CurveParam(title=basename, icon="curve.png") if "label" in kwargs: param.label = kwargs.pop("label") else: global CURVE_COUNT CURVE_COUNT += 1 param.label = make_title(basename, CURVE_COUNT) update_style_attr(stylei, param) curves.append(self.pcurve(x, yi, param, **kwargs)) if len(curves) == 1: return curves[0] else: return curves
def mcurve(self, *args, **kwargs): """ Make a curve `plot item` based on MATLAB-like syntax (may returns a list of curves if data contains more than one signal) (:py:class:`guiqwt.curve.CurveItem` object) Example:: mcurve(x, y, 'r+') """ x, y, style = self.__get_arg_triple_plot(args) if isinstance(y, ndarray): y = [y] if not isinstance(style, list): style = [style] if len(y) > len(style): style = [style[0]]*len(y) basename = _("Curve") curves = [] for yi, stylei in zip(y, style): param = CurveParam(title=basename, icon='curve.png') if "label" in kwargs: param.label = kwargs.pop("label") else: global CURVE_COUNT CURVE_COUNT += 1 param.label = make_title(basename, CURVE_COUNT) update_style_attr(stylei, param) curves.append(self.pcurve(x, yi, param, **kwargs)) if len(curves) == 1: return curves[0] else: return curves
def __init__(self, taurusparam=None, curveparam=None, axesparam=None): if taurusparam is None: taurusparam = TaurusCurveParam() self.taurusparam = taurusparam if curveparam is None: curveparam = CurveParam() style = make.style.next() # cycle through colors and linestyles update_style_attr(style, curveparam) curveparam.line.width = 2 self.curveparam = curveparam self.axesparam = axesparam self.x = Component(taurusparam.xModel) self.y = Component(taurusparam.yModel) if not self.curveparam.label: self.curveparam.label = taurusparam.xModel
def merror(self, *args, **kwargs): """ Make an errorbar curve `plot item` based on MATLAB-like syntax (:py:class:`guiqwt.curve.ErrorBarCurveItem` object) Example:: mcurve(x, y, 'r+') """ x, y, dx, dy, style = self.__get_arg_triple_errorbar(args) basename = _("Curve") curveparam = CurveParam(title=basename, icon="curve.png") errorbarparam = ErrorBarParam(title=_("Error bars"), icon="errorbar.png") if "label" in kwargs: curveparam.label = kwargs["label"] else: global CURVE_COUNT CURVE_COUNT += 1 curveparam.label = make_title(basename, CURVE_COUNT) update_style_attr(style, curveparam) errorbarparam.color = curveparam.line.color return self.perror(x, y, dx, dy, curveparam, errorbarparam)