Changeset 2659 for trunk/GSASIIplot.py
- Timestamp:
- Jan 24, 2017 1:58:38 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r2654 r2659 2349 2349 ################################################################################ 2350 2350 2351 def PlotISFG(G2frame, newPlot=False,plotType=''):2351 def PlotISFG(G2frame,data,newPlot=False,plotType='',peaks=None): 2352 2352 ''' Plotting package for PDF analysis; displays I(Q), S(Q), F(Q) and G(r) as single 2353 2353 or multiple plots with waterfall and contour plots as options … … 2389 2389 Page.Offset[0] += 1. 2390 2390 elif event.key == 'o': 2391 Page.Offset = [0,0] 2391 if G2frame.Contour: 2392 G2frame.Interpolate = 'nearest' 2393 G2frame.Cmin = 0.0 2394 G2frame.Cmax = 1.0 2395 else: 2396 Page.Offset = [0,0] 2392 2397 elif event.key == 'm': 2393 2398 G2frame.SinglePlot = not G2frame.SinglePlot … … 2397 2402 if G2frame.Contour: 2398 2403 G2frame.SinglePlot = False 2404 else: 2399 2405 Page.Offset = [0.,0.] 2406 G2frame.SinglePlot = not G2frame.SinglePlot 2400 2407 elif not G2frame.Contour and event.key == 'w': 2401 2408 G2frame.Waterfall = not G2frame.Waterfall … … 2436 2443 elif event.key == 't' and not G2frame.Contour: 2437 2444 G2frame.Legend = not G2frame.Legend 2438 PlotISFG(G2frame, newPlot=newPlot,plotType=plotType)2445 PlotISFG(G2frame,data,newPlot=newPlot,plotType=plotType) 2439 2446 2440 2447 def OnMotion(event): … … 2466 2473 2467 2474 G2frame.G2plotNB.status.DestroyChildren() 2468 if G2frame.Contour: 2469 Page.Choice = (' key press','d: lower contour max','u: raise contour max', 2470 'D: lower contour min','U: raise contour min', 2471 'i: interpolation method','s: color scheme','c: contour off','f: select data', 2472 ) 2475 if peaks == None: 2476 if G2frame.Contour: 2477 Page.Choice = (' key press','d: lower contour max','u: raise contour max', 2478 'D: lower contour min','U: raise contour min','o: reset to default', 2479 'i: interpolation method','s: color scheme','c: contour off','f: select data', 2480 ) 2481 else: 2482 Page.Choice = (' key press','l: offset left','r: offset right','d: offset down','u: offset up', 2483 'o: reset offset','t: toggle legend','c: contour on','w: toggle waterfall colors (slow!)', 2484 'm: toggle multiplot','s: color scheme','f: select data' ) 2485 Page.keyPress = OnPlotKeyPress 2473 2486 else: 2474 Page.Choice = (' key press','l: offset left','r: offset right','d: offset down','u: offset up', 2475 'o: reset offset','t: toggle legend','c: contour on','w: toggle waterfall colors (slow!)', 2476 'm: toggle multiplot','s: color scheme','f: select data' ) 2477 Page.keyPress = OnPlotKeyPress 2487 Page.Choice = () 2488 newPlot = True 2478 2489 PatternId = G2frame.PatternId 2479 2490 name = G2frame.PatternTree.GetItemText(PatternId)[4:] 2480 Pattern = []2481 2491 if G2frame.SinglePlot: 2482 name = G2frame.PatternTree.GetItemText(PatternId) 2483 name = plotType+name[4:] 2484 Id = G2gd.GetPatternTreeItemId(G2frame,PatternId,name) 2485 Pattern = G2frame.PatternTree.GetItemPyData(Id) 2486 if Pattern: 2487 Pattern.append(name) 2488 PlotList = [Pattern,] 2492 if 'G(R)' not in data: 2493 return 2494 PlotList = [data[plotType],] 2489 2495 else: 2490 2496 PlotList = [] … … 2495 2501 for item in choices: 2496 2502 Pid = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item) 2497 name = plotType+item[4:] 2498 Id = G2gd.GetPatternTreeItemId(G2frame,Pid,name) 2503 Id = G2gd.GetPatternTreeItemId(G2frame,Pid,'PDF Controls') 2499 2504 Pattern = G2frame.PatternTree.GetItemPyData(Id) 2500 2505 if Pattern: 2501 Pattern.append(item) 2502 PlotList.append(Pattern) 2506 PlotList.append(Pattern[plotType]) 2503 2507 name = plotType 2504 2508 if plotType == 'G(R)': … … 2515 2519 lenX = 0 2516 2520 for Pattern in PlotList: 2517 try: 2518 xye = Pattern[1] 2519 except IndexError: 2520 return 2521 xye = Pattern[1] 2521 2522 Ymax = max(Ymax,max(xye[1])) 2523 XYlist = [] 2522 2524 if G2frame.Contour: 2523 2525 ContourZ = [] 2524 2526 ContourY = [] 2525 2527 Nseq = 0 2526 else:2527 XYlist = []2528 2528 for N,Pattern in enumerate(PlotList): 2529 2529 xye = Pattern[1] … … 2531 2531 if not lenX: 2532 2532 lenX = len(X) 2533 if G2frame.Contour and len(P attern)>1:2533 if G2frame.Contour and len(PlotList)>1: 2534 2534 Y = xye[1] 2535 2535 if lenX == len(X): … … 2547 2547 # else: 2548 2548 # Plot.plot(X,Y,colors[N%6],picker=False) 2549 if G2frame.Contour and len(P attern)>1:2549 if G2frame.Contour and len(PlotList)>1: 2550 2550 acolor = mpl.cm.get_cmap(G2frame.ContourColor) 2551 2551 Img = Plot.imshow(ContourZ,cmap=acolor,vmin=Ymax*G2frame.Cmin,vmax=Ymax*G2frame.Cmax,interpolation=G2frame.Interpolate, … … 2596 2596 line = mplC.LineCollection(XYlist,color=colors[0]) 2597 2597 Plot.add_collection(line) 2598 if peaks != None: 2599 Plot.axvline(peaks['Limits'][0],color='g',dashes=(5,5),picker=2.) 2600 Plot.axvline(peaks['Limits'][1],color='r',dashes=(5,5),picker=2.) 2598 2601 wx.EndBusyCursor() 2599 2602 if plotType == 'G(R)':
Note: See TracChangeset
for help on using the changeset viewer.