Changeset 3763 for trunk/GSASIIplot.py
- Timestamp:
- Dec 13, 2018 10:00:16 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r3762 r3763 1079 1079 global xylim,X 1080 1080 def OnKeyPress(event): 1081 if event.key == 'd': 1082 Page.xaxis = 'd' 1083 elif event.key == 'q': 1084 Page.xaxis = 'q' 1085 elif event.key == 's': 1086 Page.yaxis = 's' 1081 if event.key == 'q': 1082 Page.qaxis = not Page.qaxis 1087 1083 elif event.key == 'f': 1088 Page. yaxis = 'f'1084 Page.faxis = not Page.faxis 1089 1085 Draw() 1090 1086 … … 1095 1091 if xpos: #avoid out of frame mouse position 1096 1092 Xpos = xpos 1097 if Page. xaxis == 'q':1093 if Page.qaxis: 1098 1094 dT = np.fabs(2.*np.pi/limx[0]-2.*np.pi/limx[1])/100. 1099 1095 Xpos = 2.*np.pi/xpos … … 1133 1129 Page.keyPress = OnKeyPress 1134 1130 1135 if Page. xaxis == 'q':1131 if Page.qaxis: 1136 1132 Plot.set_xlabel(r'q, '+Angstr+Pwrm1,fontsize=14) 1137 1133 X = 2.*np.pi/hklRef.T[4+Super] 1138 1134 else: 1139 1135 X = hklRef.T[4+Super] 1140 if Page. yaxis == 'f':1136 if Page.faxis: 1141 1137 Plot.set_ylabel(r'F',fontsize=14) 1142 Y = np. sqrt(hklRef.T[8+Super])1138 Y = np.nan_to_num(np.sqrt(hklRef.T[8+Super])) 1143 1139 Z = np.sqrt(hklRef.T[9+Super]) 1144 1140 else: … … 1146 1142 Z = hklRef.T[9+Super] 1147 1143 Ymax = np.max(Y) 1148 Plot.plot([X,X],[np.zeros_like(X),Y],color=colors[0]) 1149 Plot.plot([X,X],[np.zeros_like(X),Z],color=colors[1]) 1150 Plot.plot([X,X],[np.zeros_like(X)-Ymax/10.,Y-Z-Ymax/10.],color=colors[2]) 1151 1144 1145 XY = np.vstack((X,X,np.zeros_like(X),Y)).reshape((2,2,-1)).T 1146 XZ = np.vstack((X,X,np.zeros_like(X),Z)).reshape((2,2,-1)).T 1147 XD = np.vstack((X,X,np.zeros_like(X)-Ymax/10.,Y-Z-Ymax/10.)).reshape((2,2,-1)).T 1148 lines = mplC.LineCollection(XY,color=colors[0]) 1149 Plot.add_collection(lines) 1150 lines = mplC.LineCollection(XZ,color=colors[1]) 1151 Plot.add_collection(lines) 1152 lines = mplC.LineCollection(XD,color=colors[2]) 1153 Plot.add_collection(lines) 1154 xylim = np.array([[np.min(X),np.max(X)],[np.min(Y-Z-Ymax/10.),np.max(np.concatenate((Y,Z)))]]) 1155 dxylim = np.array([xylim[0][1]-xylim[0][0],xylim[1][1]-xylim[1][0]])/20. 1156 xylim[0,0] -= dxylim[0] 1157 xylim[0,1] += dxylim[0] 1158 xylim[1,0] -= dxylim[1] 1159 xylim[1,1] += dxylim[1] 1160 Plot.set_xlim(xylim[0]) 1161 Plot.set_ylim(xylim[1]) 1152 1162 if not newPlot: 1163 print('not newPlot') 1153 1164 Page.toolbar.push_current() 1154 1165 Plot.set_xlim(xylim[0]) … … 1168 1179 else: 1169 1180 newPlot = True 1170 Page. xaxis = 'd'1171 Page. yaxis = 's'1181 Page.qaxis = False 1182 Page.faxis = False 1172 1183 Page.canvas.mpl_connect('key_press_event', OnKeyPress) 1173 1184 Page.canvas.mpl_connect('motion_notify_event', OnMotion) 1174 1185 Page.Offset = [0,0] 1175 1186 1176 Page.Choice = (' key press','f: plot Fhkl','s: plot F^2hkl','d: d-spacing plot','q: qplot')1187 Page.Choice = (' key press','f: toggle Fhkl/F^2hkl plot','q: toggle q/d plot') 1177 1188 Draw() 1178 1189
Note: See TracChangeset
for help on using the changeset viewer.