demisjohn / pyFIMM

Python Interface to PhotonDesign's FimmWave/FimmProp software.
15 stars 4 forks source link

Mode.plot(): `pseudocolor` and `contourf` options #55

Open demisjohn opened 8 years ago

demisjohn commented 8 years ago

should add pseudocolor and contourf options. (¿And include image option, as current implementation shows image via imshow()?)

demisjohn commented 8 years ago

This exists in Device plot_input() mode plot, see ab902950b2012fb5de9887b3b2e9fa4378557dba

It seems pretty simple (see above commit for argument/docstring):

    if plot_type is 'pseudocolor':
        cont = ax.pcolor( np.array(x), np.array(y), np.array(field)[:-1,:-1] , vmin=-maxfield, vmax=maxfield, cmap=cm_hotcold)      # cm_hotcold, cm.hot, RdYlBu, RdPu, RdBu, PuOr, 
    elif plot_type is 'contourf':
        cont = ax.contourf( np.array(x), np.array(y), np.array(field)[:-1,:-1] , vmin=-maxfield, vmax=maxfield, cmap=cm_hotcold)      # cm_hotcold, cm.hot, RdYlBu, RdPu, RdBu, PuOr, 
    else:
        ErrStr = 'Device "%s".plot_input_field(): ' % self.name + 'Unrecognized plot_type: `%s`. ' % plot_type + 'Please use `contour` or `psuedocolor` or leave unsepcified.'
        raise ValueError( ErrStr )
    ax.set_xlim( d['xmin'], d['xmax'] )
    ax.set_ylim( d['ymin'], d['ymax'] )
    fig.canvas.draw()