def __new__(cls, *args, **kywds): if kywds.has_key('src'): obj = FigPlot.__new__(cls, *args, **kywds) # obj = set_hidden_vars(obj) obj._use_decimate = True return obj mpl_cmd, kywds = ProcessKeywords(kywds, 'mpl_command', 'plot') mpl_cmd = 'plot' p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_opt('s', '', 'str') ### optional argument # if mpl_cmd is 'errorbar': p.set_ndconvert("x","y") p.set_squeeze_minimum_1D("x","y") v, kywds,d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigPlot.__new__(cls, *args, **kywds) # obj = set_hidden_vars(obj) obj._use_decimate = True obj._mpl_cmd = mpl_cmd if (v["x"] is None and not isdynamic(v["y"])): v["x"] = np.arange(v["y"].shape[-1]) for name in v.keys(): obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): if 'src' in kywds: obj = FigPlot.__new__(cls, *args, **kywds) # obj = set_hidden_vars(obj) obj._use_decimate = True return obj mpl_cmd, kywds = ProcessKeywords(kywds, 'mpl_command', 'plot') mpl_cmd = 'plot' p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_opt('s', '', 'str') # optional argument # if mpl_cmd is 'errorbar': p.set_ndconvert("x", "y") p.set_squeeze_minimum_1D("x", "y") v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigPlot.__new__(cls, *args, **kywds) # obj = set_hidden_vars(obj) obj._use_decimate = True obj._mpl_cmd = mpl_cmd if (v["x"] is None and not isdynamic(v["y"])): v["x"] = np.arange(v["y"].shape[-1]) for name in v: obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._mpl_cmd = 'plot' obj._eb_container = (None, tuple(), tuple()) obj._other_artists = [] obj._objs = [] # for debug.... obj._data_extent = None obj._is_decimate = False obj._use_decimate = False obj._decimate_limit = _decimate_limit return obj if 'src' in kywds: obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj mpl_cmd = kywds.pop('mpl_command', 'plot') p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_opt('z', None, ['numbers|nonstr', 'dynamic']) p.add_opt('s', '', 'str') # optional argument p.add_key('cz', False, 'bool') # if mpl_cmd is 'errorbar': p.add_key('xerr', None) p.add_key('yerr', None) p.add_key('ecolor', None) p.add_key('elinewidth', None) p.add_key('array_idx', None) if 'cz' in kywds and kywds['cz']: p.add_key('cmap', 'jet') p.add_key('c', None) p.set_ndconvert("x", "y", "z", "xerr", "yerr", "c") p.set_squeeze_minimum_1D("x", "y", "z", "xerr", "yerr", "c") v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) obj._mpl_cmd = mpl_cmd if (v["x"] is None and not isdynamic(v["y"])): v["x"] = np.arange(v["y"].shape[-1]).astype(v["y"].dtype) if 'cmap' in v and v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] for name in v: obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._tri = None for key in default_kargs: if not obj.hasp(key): obj.setp(key, default_kargs[key]) if not obj.hasvar(key): obj.setvar(key, default_kargs[key]) return obj if 'src' in kywds: obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_var('x', ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_opt('z', None, ['numbers|nonstr']) p.add_key('s', 20) p.add_key('c', 'b', ['numbers', 'str']) p.add_key('marker', 'o') p.add_key('sscale', 1.0) p.set_ndconvert( "x", "y", "z", ) p.set_squeeze_minimum_1D( "x", "y", "z", ) # p.set_default_list(default_kargs) p.add_key('alpha', 1.0) p.add_key('cmap', 'jet') v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) for name in ('x', 'y', 'z', 's', 'c', 'alpha', 'marker', 'sscale'): obj.setvar(name, v[name]) if v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._mpl_cmd = 'plot' obj._eb_container = (None, tuple(), tuple()) obj._other_artists = [] obj._objs=[] ## for debug.... obj._data_extent=None obj._is_decimate = False obj._use_decimate = False obj._decimate_limit = _decimate_limit return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj mpl_cmd = kywds.pop('mpl_command', 'plot') p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_opt('z', None, ['numbers|nonstr', 'dynamic']) p.add_opt('s', '', 'str') ### optional argument p.add_key('cz', False, 'bool') # if mpl_cmd is 'errorbar': p.add_key('xerr', None) p.add_key('yerr', None) p.add_key('ecolor', None) p.add_key('elinewidth', None) p.add_key('array_idx', None) if 'cz' in kywds and kywds['cz']: p.add_key('cmap', 'jet') p.add_key('c', None) p.set_ndconvert("x","y","z","xerr","yerr", "c") p.set_squeeze_minimum_1D("x","y","z","xerr","yerr", "c") v, kywds,d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) obj._mpl_cmd = mpl_cmd if (v["x"] is None and not isdynamic(v["y"])): v["x"] = np.arange(v["y"].shape[-1]).astype(v["y"].dtype) if 'cmap' in v and v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] for name in v.keys(): obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._objs = [] # for debug.... obj._data_extent = None obj._coarse_artist = None obj._fine_artist = None return obj if 'src' in kywds: obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['iter|nonstr', 'dynamic']) p.add_opt('y', None, ['iter|nonstr', 'dynamic']) p.add_var('z', ['iter|nonstr', 'dynamic']) p.add_key('cmap', None) p.add_key('shade', 'flat') p.add_key('linewidth', 1.0) p.add_key('alpha', None) p.add_key('rstride', 1) p.add_key('cstride', 1) p.add_key('edgecolor', 'k') p.add_key('facecolor', 'b') p.add_key('cz', not 'color' in kywds) p.add_key('cdata', None) p.set_pair("x", "y") p.set_ndconvert("x", "y", "z") p.set_squeeze_minimum_1D("x", "y", "z") v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) if v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] for name in v: obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._objs=[] ## for debug.... obj._data_extent=None obj._coarse_artist = None obj._fine_artist = None return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['iter|nonstr', 'dynamic']) p.add_opt('y', None, ['iter|nonstr', 'dynamic']) p.add_var('z', ['iter|nonstr', 'dynamic']) p.add_key('cmap', None) p.add_key('shade', 'flat') p.add_key('linewidth', 1.0) p.add_key('alpha', None) p.add_key('rstride', 1) p.add_key('cstride', 1) p.add_key('edgecolor', 'k') p.add_key('facecolor', 'b') p.add_key('cz', not 'color' in kywds) p.add_key('cdata', None) p.set_pair("x", "y") p.set_ndconvert("x","y","z") p.set_squeeze_minimum_1D("x","y","z") v, kywds,d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) if v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] for name in v.keys(): obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): if not hasattr(obj, '_tri'): obj._tri = None # this can go away!? for key in default_kargs: if not obj.hasp(key): obj.setp(key, default_kargs[key]) if not obj.hasvar(key): obj.setvar(key, default_kargs[key]) return obj if 'src' in kywds: obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_opt('y', None, ['numbers|nonstr', 'dynamic']) p.add_var('z', ['numbers|nonstr', 'dynamic']) p.set_pair("x", "y") # x and y should be given # together p.set_ndconvert("x", "y", "z") p.set_squeeze_minimum_1D("x", "y", "z") p.set_default_list(default_kargs) p.add_key2(('use_tri', 'interp', 'shading', 'alpha')) p.add_key('cmap', 'jet') v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) for name in ('x', 'y', 'z', 'use_tri', 'interp', 'shading', 'alpha'): obj.setvar(name, v[name]) if v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): if not hasattr(obj, '_tri'): obj._tri = None # this can go away!? for key in default_kargs: if not obj.hasp(key): obj.setp(key, default_kargs[key]) if not obj.hasvar(key): obj.setvar(key, default_kargs[key]) return obj if 'src' in kywds: obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('t', None, ['numbers|nonstr', 'dynamic']) p.add_var('v', ['numbers|nonstr', 'dynamic']) p.set_ndconvert("v", "t") p.set_squeeze_minimum_1D("v", "t") p.set_default_list(default_kargs) p.add_key2(('interp', 'shading', 'alpha', 'window', 'NFFT', 'noverlap', 'sides', 'detrend', 'pad_to')) p.add_key2('cmap', 'str') v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) for name in ( 'v', 't', 'interp', 'shading', 'alpha', ): obj.setvar(name, v[name]) obj.setp("use_tri", False) if v['cmap'] is not None: kywds['cmap'] = v['cmap'] obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._tri = None for key in default_kargs: if not obj.hasp(key): obj.setp(key, default_kargs[key]) if not obj.hasvar(key): obj.setvar(key, default_kargs[key]) return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_var('x', ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_opt('z', None, ['numbers|nonstr']) p.add_key('s', 20) p.add_key('c', 'b', ['numbers', 'str']) p.add_key('marker', 'o') p.add_key('sscale', 1.0) p.set_ndconvert("x","y","z",) p.set_squeeze_minimum_1D("x","y","z", ) # p.set_default_list(default_kargs) p.add_key('alpha', 1.0) p.add_key('cmap', 'jet') v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) for name in ('x','y', 'z', 's', 'c', 'alpha', 'marker', 'sscale'): obj.setvar(name, v[name]) if v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): if not hasattr(obj, '_tri'): obj._tri = None ## this can go away!? for key in default_kargs: if not obj.hasp(key): obj.setp(key, default_kargs[key]) if not obj.hasvar(key): obj.setvar(key, default_kargs[key]) return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_opt('y', None, ['numbers|nonstr', 'dynamic']) p.add_var('z', ['numbers|nonstr', 'dynamic']) p.set_pair("x", "y") ### x and y should be given ### together p.set_ndconvert("x","y","z") p.set_squeeze_minimum_1D("x","y","z") p.set_default_list(default_kargs) p.add_key2(('use_tri', 'interp', 'shading', 'alpha')) p.add_key('cmap', 'jet') v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) for name in ('x','y', 'z', 'use_tri', 'interp', 'shading', 'alpha'): obj.setvar(name, v[name]) if v['cmap'] is not None: if isinstance(v['cmap'], Colormap): v['cmap'] = v['cmap'].name kywds['cmap'] = v['cmap'] del v['cmap'] obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): if len(args) == 3: tri = args[0] args = args[1:] else: tri = None def set_hidden_vars(obj): obj._other_artists = [] obj._objs = [] # for debug.... obj._data_extent = None return obj if 'src' in kywds: obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_key('color', 'b') p.add_key('linestyle', '-') p.add_key('linewidth', 1.0) p.set_ndconvert("x", "y") p.set_squeeze_minimum_1D("x", "y") p.add_key('mask', None) v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) if (v["x"] is None and not isdynamic(v["y"])): v["x"] = np.arange(v["y"].shape[-1]) for name in v: obj.setvar(name, v[name]) obj.setvar("kywds", kywds) obj.setvar("tri", tri) return obj
def __new__(cls, *args, **kywds): if len(args) == 3: tri = args[0] args = args[1:] else: tri = None def set_hidden_vars(obj): obj._other_artists = [] obj._objs=[] ## for debug.... obj._data_extent=None return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.add_key('color', 'b') p.add_key('linestyle', '-') p.add_key('linewidth', 1.0) p.set_ndconvert("x","y") p.set_squeeze_minimum_1D("x","y") p.add_key('mask', None) v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) if (v["x"] is None and not isdynamic(v["y"])): v["x"] = np.arange(v["y"].shape[-1]) for name in v.keys(): obj.setvar(name, v[name]) obj.setvar("kywds", kywds) obj.setvar("tri", tri) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._objs = [] # for debug.... obj._hit_idx = -1 obj._hit_seg = -1 obj._hit_artist = -1 obj._mesh = 10 obj._data_extent = None obj._data_extent_checked = False obj._sp_interp = 1 return obj if 'src' in kywds: obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.set_ndconvert("x", "y") p.set_squeeze_minimum_1D("x", "y") p.add_key('draggable', True) v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) if v["x"] is None: v["x"] = np.arange(v["y"].shape[-1]) for name in v: obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): obj._objs=[] ## for debug.... obj._hit_idx = -1 obj._hit_seg = -1 obj._hit_artist = -1 obj._mesh = 10 obj._data_extent=None obj._data_extent_checked=False obj._sp_interp = 1 return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_var('y', ['numbers|nonstr', 'dynamic']) p.set_ndconvert("x","y") p.set_squeeze_minimum_1D("x","y") p.add_key('draggable', True) v, kywds,d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) if v["x"] is None: v["x"] = np.arange(v["y"].shape[-1]) for name in v.keys(): obj.setvar(name, v[name]) obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): def set_hidden_vars(obj): if not hasattr(obj, '_tri'): obj._tri = None ## this can go away!? for key in default_kargs: if not obj.hasp(key): obj.setp(key, default_kargs[key]) if not obj.hasvar(key): obj.setvar(key, default_kargs[key]) return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('t', None, ['numbers|nonstr', 'dynamic']) p.add_var('v', ['numbers|nonstr', 'dynamic']) p.set_ndconvert("v", "t") p.set_squeeze_minimum_1D("v","t") p.set_default_list(default_kargs) p.add_key2(( 'interp', 'shading', 'alpha', 'window', 'NFFT', 'noverlap', 'sides', 'detrend', 'pad_to')) p.add_key2('cmap', 'str') v, kywds, d, flag = p.process(*args, **kywds) if not flag: raise ValueError('Failed when processing argument') obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) for name in ('v', 't', 'interp', 'shading', 'alpha',): obj.setvar(name, v[name]) obj.setp("use_tri", False) if v['cmap'] is not None: kywds['cmap'] = v['cmap'] obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): """ contour : contour plot contour(z, n) contour(x, y, z, n) contour(z, v) contour(x, y, z, v) n: number of levels v: a list of contour levels """ def set_hidden_vars(obj): if not hasattr(obj, '_tri'): obj._tri = None ## this can go away!? obj._clabels = [] obj._clabel_param = def_clabel_param obj._nouse_expression = False obj._hit_path = None obj._expression = '' return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr','dynamic']) p.add_opt('y', None, ['numbers|nonstr','dynamic']) p.add_var('z', ['numbers|nonstr','dynamic']) p.add_opt('n', 7, 'int') ### n = number of levels p.add_opt('v', None, ['numbers|nonstr', 'dynamic']) ### v = levels (array) p.set_default_list(default_kargs) p.add_key2(("FillMode", "alpha")) p.add_key2('interp', 'str') p.add_key2('cmap', 'str') p.add_key('offset', None) p.add_key('zdir', 'z') p.set_pair("x", "y") ### x and y should be given ### together p.set_ndconvert("x","y","z") p.set_squeeze_minimum_1D("x","y","z") v, kywds, d, flag = p.process(*args, **kywds) dprint2(d) if not flag: raise ValueError('Failed when processing argument') return None obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) obj._set_expression_vars(v['v']) for name in ('x','y', 'z'): obj.setvar(name, v[name]) for name in ('FillMode','alpha', 'n', 'v', "cmap", "offset", "zdir"): obj.setvar(name, v[name]) if v['cmap'] is not None: kywds['cmap'] = v['cmap'] obj.setvar("kywds", kywds) return obj
def __new__(cls, *args, **kywds): """ contour : contour plot contour(z, n) contour(x, y, z, n) contour(z, v) contour(x, y, z, v) n: number of levels v: a list of contour levels """ def set_hidden_vars(obj): if not hasattr(obj, '_tri'): obj._tri = None ## this can go away!? obj._clabels = [] obj._clabel_param = def_clabel_param obj._nouse_expression = False obj._hit_path = None obj._expression = '' return obj if kywds.has_key('src'): obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) return obj p = ArgsParser() p.add_opt('x', None, ['numbers|nonstr', 'dynamic']) p.add_opt('y', None, ['numbers|nonstr', 'dynamic']) p.add_var('z', ['numbers|nonstr', 'dynamic']) p.add_opt('n', 7, 'int') ### n = number of levels p.add_opt('v', None, ['numbers|nonstr', 'dynamic']) ### v = levels (array) p.set_default_list(default_kargs) p.add_key2(("FillMode", "alpha")) p.add_key2('interp', 'str') p.add_key2('cmap', 'str') p.add_key('offset', None) p.add_key('zdir', 'z') p.set_pair("x", "y") ### x and y should be given ### together p.set_ndconvert("x", "y", "z") p.set_squeeze_minimum_1D("x", "y", "z") v, kywds, d, flag = p.process(*args, **kywds) dprint2(d) if not flag: raise ValueError('Failed when processing argument') return None obj = FigObj.__new__(cls, *args, **kywds) obj = set_hidden_vars(obj) obj._set_expression_vars(v['v']) for name in ('x', 'y', 'z'): obj.setvar(name, v[name]) for name in ('FillMode', 'alpha', 'n', 'v', "cmap", "offset", "zdir"): obj.setvar(name, v[name]) if v['cmap'] is not None: kywds['cmap'] = v['cmap'] obj.setvar("kywds", kywds) return obj