def Struct_plot(lS, lax=None, proj='all', element=None, dP=None,
                dI=None, dBs=None, dBv=None,
                dVect=None, dIHor=None, dBsHor=None, dBvHor=None,
                Lim=None, Nstep=None, dLeg=None, indices=False,
                draw=True, fs=None, wintit=None, tit=None, Test=True):
    """ Plot the projections of a list of Struct subclass instances

    D. VEZINET, Aug. 2014
    Inputs :
        V           A Ves instance
        Nstep      An int (the number of points for evaluation of theta by np.linspace)
        axP         A plt.Axes instance (if given) on which to plot the poloidal projection, otherwise ('None') a new figure/axes is created
        axT         A plt.Axes instance (if given) on which to plot the toroidal projection, otherwise ('None') a new figure/axes is created
        Tdict       A dictionnary specifying the style of the polygon plot
        dLeg     A dictionnary specifying the style of the legend box (if None => no legend)
    Outputs :
        axP          The plt.Axes instance on which the poloidal plot was performed
        axT          The plt.Axes instance on which the toroidal plot was performed
    """
    proj = proj.lower()
    if Test:
        msg = "Arg proj must be in ['cross','hor','all','3d'] !"
        assert proj in ['cross','hor','all','3d'], msg
        lax, C0, C1, C2 = _check_Lax(lax,n=2)
        assert type(draw) is bool, "Arg draw must be a bool !"

    C0 = issubclass(lS.__class__, utils.ToFuObject)
    C1 = (isinstance(lS,list)
          and all([issubclass(ss.__class__, utils.ToFuObject) for ss in lS]))
    msg = "Arg lves must be a Struct subclass or a list of such !"
    assert C0 or C1, msg
    if C0:
        lS = [lS]
    nS = len(lS)
    if wintit is None:
        wintit = _wintit

    kwa = dict(fs=fs, wintit=wintit, Test=Test)
    if proj=='3d':
        # Temporary matplotlib issue
        dLeg = None

    for ii in  range(0,nS):
        dplot = _Struct_plot_format(lS[ii], proj=proj, Elt=element,
                                    dP=dP, dI=dI, dBs=dBs,
                                    dBv=dBv, dVect=dVect, dIHor=dIHor,
                                    dBsHor=dBsHor, dBvHor=dBvHor,
                                    Lim=Lim, Nstep=Nstep)
        for k in dplot.keys():
            dplot[k].update(kwa)

        if proj=='3d':
            lax[0] = _Plot_3D_plt_Ves(lS[ii], ax=lax[0], LegDict=None,
                                      draw=False, **dplot[proj])
        else:
            if proj=='cross':
                lax[0] = _Plot_CrossProj_Ves(lS[ii], ax=lax[0],
                                             indices=indices, LegDict=None,
                                             draw=False, **dplot[proj])
            elif proj=='hor':
                lax[0] = _Plot_HorProj_Ves(lS[ii], ax=lax[0],
                                           indices=indices, LegDict=None,
                                           draw=False, **dplot[proj])
            elif proj=='all':
                if lax[0] is None or lax[1] is None:
                    lax = list(_def.Plot_LOSProj_DefAxes('All', fs=fs,
                                                         wintit=wintit,
                                                         Type=lS[ii].Id.Type))
                lax[0] = _Plot_CrossProj_Ves(lS[ii], ax=lax[0], LegDict=None,
                                             indices=indices,
                                             draw=False, **dplot['cross'])
                lax[1] = _Plot_HorProj_Ves(lS[ii], ax=lax[1], LegDict=None,
                                           indices=indices,
                                           draw=False, **dplot['hor'])

    # recompute the ax.dataLim
    lax[0].relim()
    if proj=='all':
        lax[1].relim()
    # update ax.viewLim using the new dataLim
    lax[0].autoscale_view()
    if proj=='all':
        lax[1].autoscale_view()

    if tit is not None:
        lax[0].figure.suptitle(tit)

    if not dLeg is None:
        lax[0].legend(**dLeg)
    if draw:
        lax[0].relim()
        lax[0].autoscale_view()
        if len(lax)==2 and lax[1] is not None:
            lax[1].relim()
            lax[1].autoscale_view()
        lax[0].figure.canvas.draw()
    lax = lax if proj=='all' else lax[0]
    return lax
def Struct_plot ( lS , lax = None , proj = 'all' , element = None , dP = None , dI = None , dBs = None , dBv = None , dVect = None , dIHor = None , dBsHor = None , dBvHor = None , Lim = None , Nstep = None , dLeg = None , indices = False , draw = True , fs = None , wintit = None , tit = None , Test = True ) : proj = proj . lower ( ) if Test : msg = "Arg proj must be in ['cross','hor','all','3d'] !" assert proj in [ 'cross' , 'hor' , 'all' , '3d' ] , msg lax , C0 , C1 , C2 = _check_Lax ( lax , n = 2 ) assert type ( draw ) is bool , "Arg draw must be a bool !" C0 = issubclass ( lS . __class__ , utils . ToFuObject ) C1 = ( isinstance ( lS , list ) and all ( [ issubclass ( ss . __class__ , utils . ToFuObject ) for ss in lS ] ) ) msg = "Arg lves must be a Struct subclass or a list of such !" assert C0 or C1 , msg if C0 : lS = [ lS ] nS = len ( lS ) if wintit is None : wintit = _wintit kwa = dict ( fs = fs , wintit = wintit , Test = Test ) if proj == '3d' : dLeg = None for ii in range ( 0 , nS ) : dplot = _Struct_plot_format ( lS [ ii ] , proj = proj , Elt = element , dP = dP , dI = dI , dBs = dBs , dBv = dBv , dVect = dVect , dIHor = dIHor , dBsHor = dBsHor , dBvHor = dBvHor , Lim = Lim , Nstep = Nstep ) for k in dplot . keys ( ) : dplot [ k ] . update ( kwa ) if proj == '3d' : lax [ 0 ] = _Plot_3D_plt_Ves ( lS [ ii ] , ax = lax [ 0 ] , LegDict = None , draw = False , ** dplot [ proj ] ) else : if proj == 'cross' : lax [ 0 ] = _Plot_CrossProj_Ves ( lS [ ii ] , ax = lax [ 0 ] , indices = indices , LegDict = None , draw = False , ** dplot [ proj ] ) elif proj == 'hor' : lax [ 0 ] = _Plot_HorProj_Ves ( lS [ ii ] , ax = lax [ 0 ] , indices = indices , LegDict = None , draw = False , ** dplot [ proj ] ) elif proj == 'all' : if lax [ 0 ] is None or lax [ 1 ] is None : lax = list ( _def . Plot_LOSProj_DefAxes ( 'All' , fs = fs , wintit = wintit , Type = lS [ ii ] . Id . Type ) ) lax [ 0 ] = _Plot_CrossProj_Ves ( lS [ ii ] , ax = lax [ 0 ] , LegDict = None , indices = indices , draw = False , ** dplot [ 'cross' ] ) lax [ 1 ] = _Plot_HorProj_Ves ( lS [ ii ] , ax = lax [ 1 ] , LegDict = None , indices = indices , draw = False , ** dplot [ 'hor' ] ) lax [ 0 ] . relim ( ) if proj == 'all' : lax [ 1 ] . relim ( ) lax [ 0 ] . autoscale_view ( ) if proj == 'all' : lax [ 1 ] . autoscale_view ( ) if tit is not None : lax [ 0 ] . figure . suptitle ( tit ) if not dLeg is None : lax [ 0 ] . legend ( ** dLeg ) if draw : lax [ 0 ] . relim ( ) lax [ 0 ] . autoscale_view ( ) if len ( lax ) == 2 and lax [ 1 ] is not None : lax [ 1 ] . relim ( ) lax [ 1 ] . autoscale_view ( ) lax [ 0 ] . figure . canvas . draw ( ) lax = lax if proj == 'all' else lax [ 0 ] return lax
Plot the projections of a list of Struct subclass instances

    D. VEZINET, Aug. 2014
    Inputs :
        V           A Ves instance
        Nstep      An int (the number of points for evaluation of theta by np.linspace)
        axP         A plt.Axes instance (if given) on which to plot the poloidal projection, otherwise ('None') a new figure/axes is created
        axT         A plt.Axes instance (if given) on which to plot the toroidal projection, otherwise ('None') a new figure/axes is created
        Tdict       A dictionnary specifying the style of the polygon plot
        dLeg     A dictionnary specifying the style of the legend box (if None => no legend)
    Outputs :
        axP          The plt.Axes instance on which the poloidal plot was performed
        axT          The plt.Axes instance on which the toroidal plot was performed