Changeset 3761 for trunk/GSASIIplot.py
- Timestamp:
- Dec 12, 2018 2:38:33 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r3759 r3761 24 24 :func:`PlotStructure` Crystal structure plotting with balls, sticks, lines, 25 25 ellipsoids, polyhedra and magnetic moments 26 :func:'Plot1DSngl' 1D stick plots of structure factors 26 27 :func:`PlotSngl` Structure factor plotting 27 28 :func:`Plot3DSngl` 3D Structure factor plotting … … 1068 1069 Plot.set_ylim((HKLmin[pzone[izone][1]],HKLmax[pzone[izone][1]])) 1069 1070 Page.canvas.draw() 1071 1072 ################################################################################ 1073 ##### Plot1DSngl 1074 ################################################################################ 1075 def Plot1DSngl(G2frame,newPlot=False,hklRef=None,Super=0,Title=False): 1076 '''1D Structure factor plotting package - displays reflections as sticks proportional 1077 to F, F**2, etc. as requested 1078 ''' 1079 from matplotlib.collections import LineCollection 1080 print('1D stick plot - TBD') 1081 global xylim 1082 def OnKeyPress(event): 1083 # if event.key == 'u': 1084 # if Page.Offset[1] < 100.: 1085 # Page.Offset[1] += 1. 1086 # elif event.key == 'd': 1087 # if Page.Offset[1] > 0.: 1088 # Page.Offset[1] -= 1. 1089 # elif event.key == 'l': 1090 # Page.Offset[0] -= 1. 1091 # elif event.key == 'r': 1092 # Page.Offset[0] += 1. 1093 # elif event.key == 'o': 1094 # Page.Offset = [0,0] 1095 # elif event.key == 's': 1096 # if len(XY): 1097 # G2IO.XYsave(G2frame,XY,labelX,labelY,names) 1098 # if len(XY2): 1099 # G2IO.XYsave(G2frame,XY2,labelX,labelY,names2) 1100 ## else: 1101 ## return 1102 Draw() 1103 1104 def OnMotion(event): 1105 xpos = event.xdata 1106 if xpos: #avoid out of frame mouse position 1107 ypos = event.ydata 1108 Page.canvas.SetCursor(wx.CROSS_CURSOR) 1109 try: 1110 G2frame.G2plotNB.status.SetStatusText('X =%9.3f %s =%9.3f'%(xpos,Title,ypos),1) 1111 except TypeError: 1112 G2frame.G2plotNB.status.SetStatusText('Select '+Title+' pattern first',1) 1113 1114 def Draw(): 1115 global xylim 1116 Plot.clear() 1117 Plot.set_title(Title) 1118 Plot.set_xlabel(r'd-spacing',fontsize=14) 1119 Plot.set_ylabel(r'Fsq',fontsize=14) 1120 colors=['b','r','g','c','m','k'] 1121 Page.keyPress = OnKeyPress 1122 1123 X = hklRef.T[4+Super] 1124 Y = hklRef.T[8+Super] 1125 Z = hklRef.T[9+Super] 1126 Plot.plot([X,X],[np.zeros_like(X),Y],color=colors[0]) 1127 Plot.plot([X,X],[np.zeros_like(X),Z],color=colors[1]) 1128 Plot.plot([X,X],[np.zeros_like(X),Y-Z],color=colors[2]) 1129 1130 if not newPlot: 1131 Page.toolbar.push_current() 1132 Plot.set_xlim(xylim[0]) 1133 Plot.set_ylim(xylim[1]) 1134 xylim = [] 1135 Page.toolbar.push_current() 1136 Page.toolbar.draw() 1137 Page.canvas.draw() 1138 else: 1139 Page.canvas.draw() 1140 1141 new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(Title,'mpl') 1142 Page.Offset = [0,0] 1143 if not new: 1144 if not newPlot: 1145 xylim = lim 1146 else: 1147 newPlot = True 1148 Page.canvas.mpl_connect('key_press_event', OnKeyPress) 1149 Page.canvas.mpl_connect('motion_notify_event', OnMotion) 1150 Page.Offset = [0,0] 1151 1152 Page.Choice = (' key press','f: plot Fhkl','s: plot F^2hkl','d: d-spacing plot','q: q plot') 1153 Draw() 1154 1070 1155 1071 1156 ################################################################################ … … 2364 2449 Page.canvas.mpl_disconnect(b) 2365 2450 Page.bindings = [] 2366 Page.bindings.append( 2367 Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress) 2368 ) 2451 Page.bindings.append(Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress)) 2369 2452 if 'PWDR' in G2frame.GPXtree.GetItemText(G2frame.PickId): 2370 2453 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree()
Note: See TracChangeset
for help on using the changeset viewer.