Changeset 4355 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Mar 10, 2020 10:53:50 AM (21 months ago)
Author:
vondreele
Message:

Add RMCProfile-III tutorial to list in G2ctrlGUI so it shows up in Help
change PlotXYZvect so it shows quaternions 3D vectors colored according to the rotation component (0-90 deg)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r4347 r4355  
    3333:func:`PlotXY`                Simple plot of xy data
    3434:func:`PlotXYZ`               Simple contour plot of xyz data
    35 :func:`PlotXYZvect`           Scatter Plot for 3D cartesian vectors
     35:func:`PlotXYZvect`           Quiver Plot for 3D cartesian vectors
    3636:func:`Plot3Dxyz`             Surface Plot for 3D vectors
    3737:func:`PlotAAProb`            Protein "quality" plot
     
    51735173################################################################################
    51745174       
    5175 def PlotXYZvect(G2frame,X,Y,Z,labelX=r'X',labelY=r'Y',labelZ=r'Z',Title='',PlotName=None):
     5175def PlotXYZvect(G2frame,X,Y,Z,R,labelX=r'X',labelY=r'Y',labelZ=r'Z',Title='',PlotName=None):
     5176    ''' To plot a quiver of quaternion vectors colored by the rotation
     5177    :param wx.Frame G2frame: The main GSAS-II tree "window"
     5178    :param list X,Y,Z: list of X,Y,Z arrays
     5179    :param list R: a list of rotations (0-90) for each X,Y,Z in degrees
     5180    :param str labelX,labelY,labelZ: labels for X,Y,Z-axes
     5181    :param str Title: plot title
     5182    :param str PlotName: plot tab name
     5183    '''
    51765184   
    5177 #    def OnPageChanged(event):
    5178 #        PlotText = G2frame.G2plotNB.nb.GetPageText(G2frame.G2plotNB.nb.GetSelection())
    5179 #        if PlotText == PlotName:
    5180 #            PlotXYZvect(G2frame,X,Y,Z,labelX,labelY,labelZ,Title,PlotText)       
    5181        
    51825185    def OnMotion(event):
    51835186        G2frame.G2plotNB.status.SetStatusText('',1)
     
    51885191    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(PlotName,'3d')
    51895192    if new:
    5190 #        G2frame.G2plotNB.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,OnPageChanged)
    51915193        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
    51925194    G2frame.G2plotNB.status.SetStatusText('',1)
    51935195    Page.Choice = None
    51945196    np.seterr(all='ignore')
    5195     Plot.scatter(X,Y,Z,marker='x')
     5197    mpl.rcParams['image.cmap'] = G2frame.ContourColor
     5198    mcolors = mpl.cm.ScalarMappable()       #wants only default as defined in previous line!!
     5199    X0 = Y0 = Z0 = np.zeros_like(X)
     5200    icolor = R/90.
     5201    Plot.quiver(X0,Y0,Z0,X,Y,Z,color=mcolors.cmap(icolor),arrow_length_ratio=0.05)
    51965202    xyzlim = np.array([Plot.get_xlim3d(),Plot.get_ylim3d(),Plot.get_zlim3d()]).T
    51975203    XYZlim = [min(xyzlim[0]),max(xyzlim[1])]
     5204    XYZlim = [-1.,1.]
    51985205    Plot.set_xlim3d(XYZlim)
    51995206    Plot.set_ylim3d(XYZlim)
     
    52045211    Plot.set_zlabel(labelZ,fontsize=14)
    52055212    Plot.set_title(Title)
     5213    Page.figure.colorbar(mcolors,shrink=0.75,label='Rotation',boundaries=range(91))
    52065214    Page.canvas.draw()
    52075215       
Note: See TracChangeset for help on using the changeset viewer.